Pages

Sunday, April 7, 2013

How To Use rsync For Transferring Files

Task : Copy file from a remote server to a local computer


Copy file /home/jerry/webroot.txt from a remote server openbsd.nixcraft.in to a local computer's /tmp directory:
$ rsync -v -e ssh jerry@openbsd.nixcraft.in:~/webroot.txt /tmp

Task: Synchronize a local directory with a remote directory


$ rsync -r -a -v -e "ssh -l jerry" --delete /local/webroot openbsd.nixcraft.in:/webroot

Task: Synchronize a remote directory with a local directory


$ rsync -r -a -v -e "ssh -l jerry" --delete openbsd.nixcraft.in:/webroot/ /local/webroot

Task: Synchronize a local directory with a remote rsync server or vise-versa


$ rsync -r -a -v --delete rsync://rsync.nixcraft.in/cvs /home/cvs
OR
$ rsync -r -a -v --delete /home/cvs rsync://rsync.nixcraft.in/cvs

Resetting Wordpress Password

Get an MD5 hash of your password.)Visit md5 Hash Generator, or...http://www.miraclesalad.com/
Create a key with Python. or...
On Unix/Linux:Create file wp.txt with the new password in it (and *nothing* else)
md5sum wp.txt
rm wp.txt
"mysql -u root -p" (log in to MySQL
enter your mysql password
"use (name-of-database)" (select WordPress database)
"show tables;" (you're looking for a table name with "users" at the end)
"SELECT ID, user_login, user_pass FROM (name-of-table-you-found)" (this gives you an idea of what's going on inside)
"UPDATE (name-of-table-you-found) SET user_pass="(MD5-string-you-made)" WHERE ID = (id#-of-account-you-are-reseting-password-for)" (actually changes the password)
"SELECT ID, user_login, user_pass FROM (name-of-table-you-found)" (confirm that it was changed)
(type Control-D, to exit mysql client)
Note if you have a recent version of MySQL (version 5.x?) you can have MySQL compute the MD5 hash for you.
Skip step 1. above.
Do the following for step 7. instead.
"UPDATE (name-of-table-you-found) SET user_pass = MD5('"(new-password)"') WHERE ID = (id#-of-account-you-are-reseting-password-for)" (actually changes the password)
Note that even if the passwords are salted, meaning they look like $P$BLDJMdyBwegaCLE0GeDiGtC/mqXLzB0, you can still replace the password with an MD5 hash, and Wordpress will let you log in.

========================

Get an MD5 hash of your password. (log in to MySQL)Visit md5 Hash Generator, or...
Create a key with Python. or...
On Unix/Linux:Create file wp.txt with the new password in it (and *nothing* else)
md5sum wp.txt
rm wp.txt
>>mysql

>>>>use <name-of-database>;


>>>>show tables;---(you're looking for a table name with "users" at the end)

>>>>SELECT ID, user_login, user_pass FROM (name-of-table-you-found)" ;
>>>>"UPDATE (name-of-table-you-found) SET user_pass="(MD5-string-you-made)" WHERE ID = (id#-of-account-you-are-reseting-password-for)" (actually changes the password)

>>>>"SELECT ID, user_login, user_pass FROM (name-of-table-you-found)" (confirm that it was changed)
========================

Resize /tmp in cpanel servers

service chkservd stop
service httpd stop
service mysql stop
service postgresql stop

lsof | grep /tmp

kill the process

umount /var/tmp

umount /tmp

vi /scripts/securetmp

replace “256000″ with “512000″

rm -rf /usr/tmpDSK
/scripts/securetmp –auto

cd /tmp

ln -s /var/lib/mysql/mysql.sock

service postgresql start
service mysql start
service httpd start
service chkservd start