Posts

Showing posts with the label ssh

tunneling using SSH and connect via MySQL in different port

I use the command below with -f [requests ssh to run in the background], and -N [to not execute a remote command] $> ssh username@example.com -L 3307:example.com:3306 -p 2222 -f -N the -L argument specifies that 3307 is the port to be used locally from example.com [the remote server] on its 3306 port [MySQL default port]. Then run the command below to connect to MySQL with port 3007. $> mysql --host=127.0.0.1 --port=3307 --protocol=TCP -u mysqluser -p Hope this helps.

rsync using ssh via a sudo command

My main goal for this is, I was migrating from an old server to a new BSD server. In order to make preservation of user accounts, I manage it with this command below using rsync tool to transfer or copy the files. "rsync -p -o -g -r -a -v -e "ssh -l normaluseraddedviasudoers" --rsync-path "sudo rsync" --delete oldserver.com:/home . --log-file=/tmp/rsynclogs.txt " -p means to preserve the permission, -o means to preserve the ownership, -g means to preserve the group. -r means to recurse into ts sub-directories, -a means to archive them, -v means to use the verbose mode, -e specifies the remote login to use. With --rsync-path, it makes how to run rsync which this means like run the rsync via sudo or via root. Now, I am able to copy all the files under /home directories without prior chmod afterwards when you are on the new server. It makes the rsync set everything for you and not worrying if the files has been able to copy or not it's because you might...