Developers notebook

Category: Unix (page 1 of 5)

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.

tail -f /var/log/mail.log journalctl equivalent

journalctl -f -l SYSLOG_FACILITY=2

Send a program to run in the background and close shell

disown -h


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:

Scan a network for MS SQL servers

nmap -p T:1433 -sV -oG tcp_scan_results.txt


Monitor MySQL restore progress with pv

pv {source_database.sql} | mysql -u{user} -p {destination_database}


UNIX timestamp and Active Directory timestamp for given date and time

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


//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;

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;

Find and replace a line with sed

sed -i “/;Thing to find/c\Thing to replace it with” /path/to/file

sed -i “/;date.timezone =/c\date.timezone = Europe/London” /etc/php.ini

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

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/ start" >> /etc/init.d/boot.local

Original source:

Older posts

© 2017

Theme by Anders NorenUp ↑