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, rysync is used for rsync large data migration, and fetch/wget is used. the most time is ftp, the most... 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.