103
33
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 6 years ago.
I am having trouble copying files from a remote server using SSH. Using PuTTY I log in to the server using SSH. Once I find the file I would like to copy over to my computer, I use the command:
scp username@host.com:/dir/of/file.txt \local\dir\
It looks like it was successful, but it only ends up creating a new folder labeled 'localdir' in the remote directory /dir/of/.
How can I copy the file to my local computer over SSH?
Follow
17k20 gold badges95 silver badges175 bronze badges
asked May 31 '15 at 3:07
1,0432 gold badges8 silver badges6 bronze badges
- Your question is not clear on this: are you running scp on your local computer or inside the remote shell via SSH? – William Price May 31 '15 at 3:17
- Inside the remote shell via SSH, I believe. – Vincent May 31 '15 at 4:02
5 Answers
200
It depends on what your local OS is.
If your local OS is Unix-like, then try:
scp username@remoteHost:/remote/dir/file.txt /local/dir/
If your local OS is Windows ,then you should use pscp.exe utility. For example, below command will download file.txt from remote to D: disk of local machine.
pscp.exe username@remoteHost:/remote/dir/file.txt d:\
It seems your Local OS is Unix, so try the former one.
For those who don't know what pscp.exe is and don't know where it is, you can always go to putty official website to download it. And then open a CMD prompt, go to the pscp.exe directory where you put it. Then execute the command as provided above
Follow
answered May 31 '15 at 3:23
15.8k11 gold badges43 silver badges63 bronze badges
- My local OS is Windows. I downloaded the pscp.exe from the putty website. I tried opening it up and nothing came up. Also, I tried the command you listed above and was given: pscp.exe comman not found. Also tried it without the .exe and resulted in the same error. – Vincent May 31 '15 at 3:57
- 2
- Open a CMD prompt, and go to the pscp.exe directory where you put it. Then execute the command as provided above. – mainframer May 31 '15 at 4:01
- 1
- using scp on a mac has to be provided ./ parameter to signify that the file has to be downloaded in the current folder on mac machine. – Sarang Manjrekar Jul 2 '18 at 11:11
- 2
- With Windows Subsystem for Linux (WSL, basically Ubuntu on Windows) you can now also open up Bash if your Local OS is Windows, and just use scp. Pro-tip: you can access your Windows file system from WSL. It's under /mnt/c. So you can do something like this: scp username@remoteHost:/remote/dir/file.txt /mnt/c – gijswijs Apr 25 '19 at 3:42
- 3
- As of the 2018 Autumn update, Windows 10 now comes with OpenSSH and is on PATH. This means you can use the scp command on Windows 10, too. – jaunt Sep 23 '19 at 20:45
'LINUX' 카테고리의 다른 글
How to configure load balancing using Nginx (0) | 2021.07.25 |
---|---|
CentOS 7에서 fuser 설치 및 사용법 (nginx 0.0.0.0:80 trouble shooting) (0) | 2021.07.23 |
What is the difference between Proxy and Reverse Proxy? | How To Use Reverse Proxy for Access Management Control (0) | 2021.07.15 |
VS Code로 FTP 연결하여 코드수정 바로 적용하기(ftp-simple) (0) | 2021.07.15 |
TCP 프록시 부하 분산 개요 (Proxy Network Load Balancing) (0) | 2021.07.14 |