# How to Download a File from Server with SSH

**URL:** https://www.compsmag.com/blogs/download-file-server-with-ssh/
**Author:** Ayushi Chauhan
**Published:** 2023-03-20
**Updated:** 2023-03-20
**Categories:** Blogs
**Reading Time:** 3 min

---

Using the secure connection method known as SCP, you can send files from one computer to another. It is frequently used How to Download a [File](https://compsmag.com/best/file-manager/)from Server with SSH protocol. The fact that SCP encrypts the data being sent to ensure that it is secure and out of the reach of outside parties is one of its best features.

This is crucial when sending sensitive data like passwords or financial information. To use SCP, you must have an SSH client set up on your local [computer](https://compsmag.com/best/computers/). An SSH client ought to be set up if you are using a Unix-based operating system, such as Linux or macOS.

1. **Gather the Necessary Information**
Login credentials – username, server name or IP address, and password



The port number for SSH connections



The path to the file on the remote server



The path to the download location
2. Login credentials – username, server name or IP address, and password
3. The port number for SSH connections
4. The path to the file on the remote server
5. The path to the download location
6. **Create the SCP Command**
The SCP command looks like this:
scp -P [port number] [username]@[server name or IP]:[path to file on server] [path to file on local PC]



Replace the sections in bold with the information you gathered in step 1. For example, the command used for this example is:
scp -P 7022 root@206.196.xxx.xxx:/root/filetodownload.txt C:\Users[UserName]\Desktop\
7. The SCP command looks like this:
scp -P [port number] [username]@[server name or IP]:[path to file on server] [path to file on local PC]
8. scp -P [port number] [username]@[server name or IP]:[path to file on server] [path to file on local PC]
9. Replace the sections in bold with the information you gathered in step 1. For example, the command used for this example is:
scp -P 7022 root@206.196.xxx.xxx:/root/filetodownload.txt C:\Users[UserName]\Desktop\
10. scp -P 7022 root@206.196.xxx.xxx:/root/filetodownload.txt C:\Users[UserName]\Desktop\
11. **Running the Command**
Launch the command prompt in [Windows](https://compsmag.com/best/windows-apps/). SCP is pre-installed on Windows 10 by default. We'll run the commands in this example using the Windows PowerShell tool. Yellow and the colour contrast, and syntax highlighting is a welcome change from the boring command line.



In Windows, you can find the "known hosts" file at:
C:\Users[UserName].ssh\known hosts
12. Launch the command prompt in [Windows](https://compsmag.com/best/windows-apps/). SCP is pre-installed on Windows 10 by default. We'll run the commands in this example using the Windows PowerShell tool. Yellow and the colour contrast, and syntax highlighting is a welcome change from the boring command line.
13. In Windows, you can find the "known hosts" file at:
C:\Users[UserName].ssh\known hosts
14. C:\Users[UserName].ssh\known hosts

## How does SSH work?

SSH is a standard component of every Unix, Linux, and Mac server and is accessible in all data centres. Secure remote access to resources, remote command execution, the delivery of software patches and updates, and other administrative or management tasks have all been made possible with the help of SSH connections.

SSH is used to manage routers, server hardware, virtualization platforms, operating systems. It also establishes a secure channel between local and remote computers. Programs like Telnet, rlogin (remote login), and rsh that use insecure terminal emulators or login methods were intended to be replaced by Secure Shell (remote shell). SSH makes it possible to log in and launch terminal sessions on distant systems.

## FAQ

#### Can I download file from SSH?

SSH keys and aliases make it possible to connect to an SSH server without entering the password each time, making it possible to download private files quickly and securely.

#### How do I download a file from a remote local server?

SCP syntax is not too complicated. Simply enter SCP, the remote username, @, the IP address or host, a colon, and the file's path. The remote user's home directory is the default path if it is not specified.

#### How do I access files via SSH?

1. Log in to the local host as root.
2. Generate Apache user authorized_keys file. ...
3. Copy the generated authorized_keys file to the remote host. ...
4. Log in to the remote host and move the authorized_keys file to the Apache user root directory (/var/www/.ssh)

---

*End of Article*