When it comes to transferring files between networked systems, Linux and Unix users have a variety of options. Knowing how to use Rsync to transfer files over SSH is necessary for Cyber Security Professionals, and here are the guide for you to know.
SSH and FTP are the most widely used data transfer protocols. While FTP is widely used, it is always preferable to use SSH because it is the most secure method of file sharing.
There are other SSH file transfer utilities, such as scp and sftp, but none of them provide all of the functions that rsync has. rsync can be used for a variety of tasks, including data mirroring, incremental backups, and file transferring between systems.
Both the destination and source computers must have the rsync program installed. If it isn't already installed, use your distribution's package manager to do so:
Ubuntu and Debian:
$ sudo apt install rsync
CentOS and Fedora:
$ sudo yum install rsync
You can use rsync to move files and directories from and to remote servers using SSH.
The following is the standard syntax for using rsync to transfer files:
Local to Remote host: rsync [OPTION]... -e ssh [SRC]... [[email protected]]HOST:DEST
Remote to Local host: rsync [OPTION]... -e ssh [[email protected]]HOST:SRC... [DEST]
The source directory is SRC, and the destination directory is DEST. HOST is the remote SSH host or IP address, and USER is the remote SSH username.
You can skip the -e ssh argument because recent versions of rsync are configured to utilise SSH as the default remote shell.
To transfer a single file /opt/file.zip from a local system to the /var/www/ directory on a remote machine with IP 220.127.116.11, for example, type:
$ rsync -a /opt/file.zip [email protected]:/var/www/
The -a option syncs folders in a recursive manner, transfers special and block devices, and keeps symbolic links, modification times, group, ownership, and privileges intact.
You will be requested to input the user password if you haven't set up a password less SSH login to the remote machine.
The file will be rewritten if it already exists on the remote server. Specify a new name for the file if you want to store it under a different name:
$ rsync -a /opt/file.zip [email protected]:/var/www/file4.zip
Use the remote location as the source and the local location as the destination to transfer data from a remote to a local machine:
$ rsync -a [email protected]:/var/www/file6.zip /opt/
Using rsync over SSH to move directories is the same as transferring files.
It's vital to understand that rsync treats source folders with a trailing slash / differently. When there is a trailing slash in the source directory, rsync will only replicate the contents of the source directory to the destination directory. The source directory will be copied into the destination directory if the terminating slash is omitted.
To move the local /opt/website/images/ directory to a remote machine's /var/www/images/ directory, for example, type:
$ rsync -a /home/linuxize/images/ [email protected]:/var/www/images/
If you want to synchronise the local and remote directories, use the —delete option. When you use this option, be aware that it will delete files from the destination directory if they do not exist in the source directory.
$ rsync -a --delete/home/linuxize/images/[email protected]:/var/www/images/
If SSH on the remote host is listening on a port other than 22, use the -e option to specify the port. If SSH is listening on port 3322, for example, you would type:
$ rsync -a -e "ssh -p 3322" /home/linuxize/images/[email protected]:/var/www/images/
When transferring huge amounts of data, it's best to run the rsync command in a screen session or use the -P option, which tells rsync to show a progress bar and keep the files that haven't completed the transfer:
$ rsync -a -P /home/linuxize/images/ [email protected]:/var/www/images/
Now you know how to copy and synchronise files and directories using rsync over SSH. This is how to use Rsync to transfer files over SSH. Do visit our CEH page to know more about our Course Curriculum in Ethical Hacking.
Why Choose Indian Cyber Security Solutions (ICSS) ?
Indian cyber security Solutions is one of best institute of India among other institute in India. ICSS offer as CEHv11 Courses in India as well as kali Linux. ICSS has won as many award for giving the online training as well as offline training. Its way of giving the training is unique which is easily adapted by the student as well as the professional. Due to way how ICSS trained the student it has got as many award some of award are Tech Brand of 2020,Ten most trusting cyber security certification provider 2021 and many more.
Among the many Ethical Hacking course in India, Indian Cyber Security Solutions would be the right for you to join. We have the right set of practical lab classes set up for students to learn as well as industry grade trainers who would conduct the classes and impart the right set of Cyber Security Knowledge to students. Our efforts have been acknowledged by various reputed administrative institutes, such as "Top Ten Training Institutes in India in 2020” by Silicon India; as well as Ten Most Trusted Training & Cyber Security Certifications Provider, 2021 by The Knowledge Review.
As an Education Institute, we are also cyber security service provider to corporate organization. Services like VAPT, Web Penetration Testing, Network Penetration Testing, Mobile Application Penetration Testing to corporate organization like IRCTC, HDFC, Cambridge Technologies, and many more. With this, Indian Cyber Security Solutions have been acknowledged as the 20 Tech Brands of 2021. by Business Connect India.
Our Cyber Security Services
Cyber Security is extremely important for every organisation and that we understand that data theft avoided is better than data theft done. Thus we also provide cyber security services to various MNCs across India. Our team is professional in providing Web Application Penetration Testing, Network Penetration Testing, Mobile Application Penetration Testing to clients.
We this, we have been acknowledged as the top 20 most Cyber Security Trusted Brands for 2021 by The Global Hues. We stand by to our commitment in providing the right cyber security training to students. We have provided services to clients like Madhya Pradesh Gramin Bank, Odisha State Pollution Control Board, HDFC Life Insurance Corporation, Qatar Development Bank and many more.
Globsyn Crystals Building,5th Floor, Unit-4, Webel MoreKolkata – 700091
Chirush Mansion, 3478J HAL 2nd Stage,13th A Main Road Indiranagar Bangalore – 560008 Land Mark: Behind New Horizon School
Indian Cyber Security Solutions Cyber Security Research & Analytics Center Vine Avenue Moncton NB,Canada, PO E1E 1J9
Indian Cyber Security Solutions Australia (Research and Development Center)11 Darling Street, Hughesdale Melbourne VIC. 3166