In the example above host and host2 can route traffic between them, either because they are on the same network or because there are routers in between that route the traffic. scp files between two remote server that are not in the same network scp say now you want to copy the same table file from jane's home folder to pete's home folder in another remote machine. With scp you can copy files between remote servers from a third server without the need to ssh into any of them, all weight lifting will be done by scp itself. scp /home/user/Ĭopy one single file from a remote server to another remote server Let's say now you want to copy the same file from jane's home folder in to your local home folder. scp /home/user/table.csv one single file from a remote server to your current local server scp /path/to/destination-folder ExamplesĬopy one single local file to a remote destination scp /path/to/source-file if you wan to copy the file /home/user/table.csv to a remote host named and copy there to jane's home folder, use this command. Just to clarify, you can avoid specifying both username and host in origin and destination, and the scp command will work just like the cp command, copying a local file to a local destination. And in the same way as with origin, if the host is not specified, the files will be copied locally. Same as above if the user is not specified but a hostname is given it will defaults to the current username and will try to log in the remote server using that user. The destination, where you specify the path where the files are going to be copied, once again, it can contain or not the information about the remote host and/or user in that host. If the host is not specified, it will look for the file locally using any given path. If the user is not specified it will defaults to the current user in the machine where you are typing the command. The origin, where you specify the file or files to be copied, it can contain or not the information about a remote host, and it can also contain the information about the user owning the file or files in that remote host. Is the command itself and tells the operating system to copy one or more files over a secure shell connection, better known as ssh connection. We are going to explain the basic part of it: scp. the complete syntax and every option of scp command is out of the scopy of this page, you can always enter a the command prompt man scp We will learn in this tutorial about the basic use of the command, and some useful examples and scenarios where you can use it. You can use scp on Linux, Mac and Windows (using WinSCP). In the last case the traffic goes directly from one server to the other without passing through your system, that is a good thing if you have a slow Internet connection
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |