Copies the files to the remote server.
Do a rsync to make sure it asks for the password for your account on the remote server, and successfully copies the files to the remote server.
The following example will synchronize the local folder /home/check/test.txt to the remote folder 100.101.102.11:/root/check server).
This should ask you for the password of your account on the remote server.
rsync -avz -e ssh /home/check/test.txt 100.101.102.11:/root/check
By using SSH protocol you can transferred the data in a secured connection with encryption. You need to provide the root password to connect this, using SSH option will send your logins in an encrypted manner so that your password will be safe.
Sync a file & directory from remote to local with –include option
In this below example, rsync command will include only .php files and exclude everything in that directory.
rsync -avzeh ssh --include '*php' --exclude '*'
Syncing file & directory from remote to local with –exclude option
In this below example, rsync command will exclude only .txt files and include everything in that directory.
rsync -avze ssh --exclude '*txt'
When you run rsync commands, it may ask for password while doing rsync from local to remote server. If you want to run rsync automatically without password prompt, you must generate and use SSH key based authentication.