
After changing the port number, we may need to restart ssh.


Change the port number to the one which we want to use. First, we need to install ssh, typing the commandĪfter ssh is installed, go to /etc/ssh/ and edit the file sshd_config as root. To copy files to the server at a specific port, we need to make some changes in the ssh configuration. If we need to copy files from server-1 to server-2, we can use the following command, scp Files To a Specific Port (Linux) It is also possible to copy files between two remote servers. scp -r /home/myfolder/* command will copy all the files in the specified location to the destination

We need to use '-r' to specify that we need to recursively process the folder and its contents.Įxample: scp -r /home/myfolder will copy the folder and all the files in the folder to the destination location. Suppose we need to transfer a folder and its contents from a server or to a server instead of a file, we need a small change in the command. We just need to provide them in a space-separated list. i.e, it should be like, scp source/file file2 file3 needed, it is also possible to copy from different locations. Instead of copying the complete folder we can achieve this by specifying the required files in the same command separated by space. Suppose we need to copy multiple files from a location. To get the full path to the file you want to transfer, enter the “pwd” command on the CLI of the remote server while the file is in your current directory.Copying Single File from Server to Local System It’ll either be 22 (the default port), or it’ll be given to you when you order your VPS from your hosting provider. Learn more about basic PuTTY commands.Īs for the port number, you’ll need to know which SSH server port your VPS listens to. You should already have the login credentials when you connect to the server using PuTTY, or some other tool, so we won’t go into it here.

The path to the file on the remote server.Login credentials – username, server name or IP address, and password.To transfer a file from a remote server via SSH using SCP, we need the following pieces of information: Step 1: Gather the Necessary Information.
