NathanFriend.co.uk

Developers notebook

Category: Software (page 1 of 8)

NetDISCO Active Directory Authentication

~/environments/deployment.yml


ldap:
servers:
- 'DOMAIN_CONTROLLER_HERE'
base: 'OU=Accounts,DC=domain,DC=com'
proxy_user: 'LDAP_BIND_USER'
proxy_pass: 'LDAP_BIND_PASSWORD'
user_string: 'DOMAIN_HERE\%USER%'
opts:
debug: 0

Join Ubuntu Mate 16.04 to an MS Active Directory Domain

Bash script to prepare an Ubuntu Mate 16.04 host for joining to a MS Active Directory Domain. https://github.com/nathanfriend/domain_join

Send a program to run in the background and close shell

./some_long_running_process
ctrl+z
bg
disown -h
exit

Source: http://www.kossboss.com/linux—move-running-to-process-nohup

Pull files from a remote server over ssh with sudo privilege escalation

rsync -a -e “ssh” –bwlimit=10000 –rsync-path=”sudo rsync” remoteuser@remoteserver:/remotepath .

Original source: https://crashingdaily.wordpress.com/2007/06/29/rsync-and-sudo-over-ssh/

UNIX timestamp and Active Directory timestamp for given date and time

<php
/** Returns UNIX timestamp and Active Directory timestamp for given date and time */

date_default_timezone_set('Europe/London');

//Format dd-mm-yyyy
$dateFromForm = '24-05-2020';

//Format hh:mm:ss
$timeFromForm = "00:00:00";

$CLI = 1;
if ($CLI = 0) { $LF = "<br>";} else {$LF = "\r\n";}
$dateWithTime = $dateFromForm." ".$timeFromForm;

function convertDateToUnix($input) {
$format = 'd-m-Y H:i:s';
$date = DateTime::createFromFormat($format, $input);
$UNIXTimestamp = $date->getTimestamp();
return $UNIXTimestamp;
}

function convertUnixtoWin($input) {
return ($input+11644473600)*10000000;
}

$UNIX=convertDateToUnix($dateWithTime);
echo "*** Welcome to the Timestamp converter ***".$LF;
echo $LF."You entered: ".$dateWithTime.$LF;
echo $LF."UNIX Timestamp is ".$UNIX.$LF;
echo $LF."Windows Timestamp is ".convertUnixtoWin($UNIX).$LF;
echo $LF."**************************************".$LF;

NTLM error on openSUSE 13.2

When setting up NTLM on openSUSE I was getting a 500 server error from Apache.

In the error log: ntlm_auth reports Broken Helper: BH NT_STATUS_ACCESS_DENIED NT_STATUS_ACCESS_DENIED

Solved with setfacl -m u:wwwrun:rx /var/lib/samba/winbindd_privileged

Windows Update error 80244022

My PC wasn’t getting it’s updates from our on site Windows update server.  Follow these steps to get the updates directly from Microsoft.  This worked for me on Windows 8, should be good for Windows 7 too.

1. Open registry editor (Start menu –> Run –> regedit)

2. Find the following path HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU

3. Change the value of the UseWUServer from 1 to 0 (double click on it, change the value and click OK)

4. Restart Windows Update service (Start menu –> Run –> services.msc –> find the Windows Update service and click on Restart)

You may find group policy sets it back next time they are applied

Orignal source http://www.geek.giriblog.com/windows-error-80244022-solved.html

Run command after boot SuSE

Append a command to the end of file /etc/init.d/boot.local to be executed after booting.

echo “command” >> /etc/init.d/boot.local

Example: echo "/opt/zend/bin/zendctl.sh start" >> /etc/init.d/boot.local

Original source: http://workingbinary.com/2011/05/how-to-run-command-after-boot-on-opensuse/

MySQL restart OpenSuSe

I’ve always used /etc/init.d/mysql restart  to restart MySQL on SuSe Linux.  In OpenSuSe 13.2 this script has disapeared.

The new command is rcmysql restart

MySQL Error Number: 1118 Row size too large (> 8126)

During testing of a web form I’m developing that has some lengthy input fields, I hit the upper size limit for the VARCHAR field type.  Looking for a suitable alternative I found.

TINYBLOB, TINYTEXT (255 Bytes)
BLOB, TEXT (64 Kilobytes)
MEDIUMBLOB, MEDIUMTEXT (16 Megabytes)
LONGBLOB, LONGTEXT (4 Gigabytes)

I went for TEXT which seemed more than big enough.  However when you have multiple large fields being submitted together MySQL may still error.  To overcome this.  Edit /etc/my.cnf under the [MySQL] section add :

innodb_file_per_table
innodb_file_format = Barracuda

Restart MySQL for the change to take effect /etc/init.d/mysql restart

Then update your table to use the compressed row format, setting the block size to 8.

ALTER TABLE appraisal
 ENGINE=InnoDB
 ROW_FORMAT=COMPRESSED 
 KEY_BLOCK_SIZE=8;
Older posts

© 2017 NathanFriend.co.uk

Theme by Anders NorenUp ↑