Linux Remote File Transfer scp and sftp

Source: Internet
Author: User
Tags scp command ssh port

For linux Remote File Transfer scp and sftp details, there are usually three methods: local network and remote network for data exchange or data migration. One is ftp, second, wget/fetch. Third, rsync uses rysync for large-scale data migration, followed by fetch/wget. The longest is ftp, and the slowest is ftp. in the past few days, ssh scp is used for data migration during busy data migration. The speed and effect are good. In particular, many servers change the default ssh port 22 to a special port for security purposes. So. When using scp or sftp, you must specify the port through which to migrate data. Now, write down the scp command for this special port. Scp-P port user @ serverip:/home/user/filename upper-case port P is the parameter, port user is the ssh user serverip is the remote server ip address or domain name, And/home/user/filename is the Remote Server File Name/home/user/filename is the local service Server File Name. This command is used to copy the remote filename to the local directory. Scp has a huge role. For detailed usage, you can use man scp or scp-help. The following is a detailed description of scp... The scp command of linux can copy files and directories between linux; ========================= scp command =================================== scp can copy files between two linux Hosts; command basic format: scp [optional parameter] file_source file_target ====== copy from local to remote =====* copy file: * command format: scp local_file remote_username @ remote_ip: unique or scp local_file remote_username @ remote_ip: remote_file or scp local_file remote_ip: unique or scp local_file remote_ip: remote_file the user name is specified at 1 and 2, after the command is executed, enter the password, 1st Only remote directories are specified. The file name remains the same. The file name is specified for the first 2nd directories. No user name is specified for the third directory. After the command is executed, enter the user name and password, 3rd only specifies the remote directory, the file name remains the same, 4th specify the file name; * routine: scp/home/space/music/1.mp3 root@www.cumt.edu.cn: /home/root/others/musicscp/home/space/music/1.mp3 root@www.cumt.edu.cn:/home/root/others/music/002.mp3 scp/home/space/music/1.mp3 www.cumt.edu.cn: /home/root/others/musicscp/home/space/music/1.mp3 www.cumt.edu.cn:/home/root/others/music/002.mp3 * Copy Directory: * Command Format: Scp-r local_folder remote_username @ remote_ip: remote_folder or scp-r local_folder remote_ip: remote_folder 1st specify the user name. After the command is executed, enter the password. 2nd No user names are specified, after the command is executed, enter the user name and password; * routine: scp-r/home/space/music/root@www.cumt.edu.cn: /home/root/others/scp-r/home/space/music/www.cumt.edu.cn:/home/root/others/the command above copies the local music directory to the remote others directory, that is, there is a remote connection after the replication .. /others/music/directory scp-r/home/space/music /. * www.cumt.edu.cn :/Home/root/others/musc/copy the directory.-r Recursively copies the directory. ". *" Copies hidden files. You must create a directory at the remote end. =========Copy from remote to local ====== copy from remote to local, you just need to change the order of the last two parameters from local to remote command; for example: scp root@www.cumt.edu.cn:/home/root/others/music/home/space/music/i1_scp-r www.cumt.edu.cn: /home/root/others/home/space/music/scp is easy to use, but it cannot list remote directories or change directories. The more complex method is sftp. Sftp: sftp-o port = 60066 user @ serverip:/home/user/where the-o port option specifies a non-default ssh port.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.