Author Archive

Add a user to .htpasswd

echo -e “myuser:`perl -le ‘print crypt(“mypassword”,”abc12345abc”)’`” > ./.htpasswd

Comments

Delete all files matching a pattern within a directory recursively

find . | grep -r -e “SomeFilePrefix.*\.php” | xargs rm

Comments

Mount remote system locally over ssh

with certificate authentication or password prompt
sshfs my_username@example.com:/home/my_user /mnt/my_remote_system  -o reconnect -o follow_symlinks -o allow_other

 

or with plain text password:

echo “my_password” | sshfs my_username@example.com:/home/my_user /mnt/my_remote_system  -o reconnect -o follow_symlinks -o allow_other -o password_stdin

Comments

Resume a file using rsync over ssh

Sometimes it happens that a file transfer using SCP fails for some reason. Oh no! now you have to start from scratch…

There’s a quick workaround, use rsync over ssh. No rsyncd is needed, and the transfer is secure. It works like this:

rsync -P –rsh=’ssh -pPORT_HERE’ USERNAME_HERE@REMOTE_HOST_HERE:REMOTE_FILE_LOCATION_HERE LOCAL_FILE_LOCATION_HERE

It may still take some time to run based on the file size, but it will certainly take less overall time as it will not transfer the whole file again.

Comments