
- Ssh copy files in one folder to another how to#
- Ssh copy files in one folder to another install#
- Ssh copy files in one folder to another update#
Scp -P 8984 -r $HOME/Desktop/webapp is an example of a directory's copy: Copy a directory from the local computer to the server over SSH. The command to copy a directory using SCP is: For that, you must add the option -r meaning to recursively copy directories. It is possible to copy a directory with many files and folders over SSH. Scp -i $HOME/.ssh/id_rsa $HOME/Desktop/debug With an SSH key, the command template is: The folder directory in the local computer where the file will be copied The path of the file on the remote server to copy locally We have two parameters to explain: Parameter The command template for a copy from the remote server to the local computer is the following:

The file on your remote server is located at $HOME/production/webapp/logs.zip and you want to copy it to your local computer at $HOME/Desktop/webapp. Scp -i $HOME/.ssh/id_rsa $HOME/Desktop/webapp.zip files from remote server to local machineĪs a use case, Let's say on your remote, you have your Node.js application log files you want to download locally for better analysis. The parameter is the location of the SSH private key on your local computer (usually $HOME/.ssh/id_rsa). You can then generate an SSH key on your computer, copy the public SSH key and add it to the remote server file that stores the authorized server to connect with, usually located at $HOME/authorized_keys. Using the SCP command with SSH keyĪn SSH key is one of the most secure ways to access a server through SSH. Scp -P 8984 $HOME/Desktop/webapp.zip command will ask for the password associated with the server user and proceed to the copy if valid. The folder directory in the remote server where the file will be copiedįor the use case we defined early, this is the command to execute: The remote server port It is not required and must be used only if you changed the default SSH port (22) The path of the file on your local computer The command template for a copy from a local machine to a remote server is the following: SCP is the CLI command we use to perform copy over SSH. We cannot use $HOME because it will be interpreted as the home folder on the local computer. The symbol ~ represents the user's home folder on the remote server. In this scenario, you have a file on your local computer you want to copy to the server for a particular use case. Copying files from local machine to remote machine Use my referral link to get €20 after you sign up. The server running this blog and all my side projects are hosted here.

You can buy a VPS on Hetzner, which provides affordable servers with good performance.
Ssh copy files in one folder to another install#
If you are on Windows, install an SSH client such as Putty or use the WSL. You will need a computer running on a UNIX system (Any Linux distribution or MacOS) to follow this tutorial.

Ssh copy files in one folder to another how to#
In this post, we will see how to transfer files via SSH.
Ssh copy files in one folder to another update#
Update the application configuration file running on a remote server.Pull logs for a running application in production.

