There are many options available to Rsync and SCP over non-standard ssh port and key files. Here is the simple example to backup your files and configure with Cron jobs.

Rsync is a great tool that allows you to transfer and synchronize data between servers. The command can be used over SSH which encrypts the connection. It also provides a lot of options which can be used such as archive mode, backup mode, data compression during the transfer etc.

SCP allows files to be copied to, from, or between different hosts. It uses ssh for data transfer and provides the same authentication and same level of security as ssh. By default, scp uses the Triple-DES cipher to encrypt the data being sent. Using the Blowfish cipher has been shown to increase speed. This can be done by using option -c blowfish in the command line.

rsync and scp

rsync and scp over non-standard ssh port and key

 

Create a password-less SSH-key on the server

If you want to create a password less ssh key auth without asking the password, use below steps to configure it.

Generate SSH key pair
#ssh-keygen

Make sure you gave valid path.

Authorize the SSH public key

Once created we can authorize the usage of the SSH key pair by adding the SSH public key inside a file called authorized_keys situated inside the .ssh/ folder:

Copy .ssh/id_rsa.pub to remote client server .ssh/authorized__keys

Verify the authentication is working fine.

# ssh <user>@<ip>

Rsync over non-standard ssh port and key

There are many options and command available in Rsync to copy the files, here given an only simple example.

Over non-standard ssh port

# rsync -avz -e "ssh -p $portNumber" /source/dir/ [email protected]:/remote/dir

Over ssh key

# rsync -avz -e "ssh -i /home/ssh-key.pem" /source/dir/ [email protected]:/remote/dir

Different port and SSH key

# rsync -avz -e "ssh -p $portNumber -i /home/ssh-key.pem" /source/dir/ [email protected]:/remote/dir

 

SCP over non-standard ssh port and key

There are many options and command available in SCP to copy the files, here given only simple example.

Over non-standard ssh port

# scp -r -P $portNumber /source/dir/ [email protected]:/remote/dir

Over ssh key

# scp -r -i /home/ssh-key.pem /source/dir/ [email protected]:/remote/dir

Different port and SSH key

# scp -r -P $portNumber -i /home/ssh-key.pem /source/dir/ [email protected]:/remote/dir

 

5.00 avg. rating (92% score) - 1 vote
Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive