Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

scp from remote host to local host [closed]

Tags:

linux

unix

scp

I am trying to copy a file from a remote machine to the local machine I am using. Whenever I run this command I get prompted to enter a password. I am not sure what to enter for the password as I never configured any password. Anyone have any tips?

scp stuff.php djorge@localhost:Users/djorge/Desktop 
like image 837
cool_cs Avatar asked May 31 '12 17:05

cool_cs


People also ask

Can you scp from remote to local?

Copy or Download a File From Remote to Local Using SCP SCP syntax is pretty simple. Just invoke SCP followed by the remote username, @, the IP address or host, colon, and the path to the file. If not specified, the default path is the remote user's home directory.

How do I transfer files from a remote server to a local machine?

To copy the files you will need to first invoke the SCP, followed by the remote username@IP address, path to file. If you do not specify the path, it is assumed as default in this case which will be the user's home directory, this will be followed the path where the file will be stored locally.

How copy file from Unix to local machine?

The scp command issued from the system where /home/me/Desktop resides is followed by the userid for the account on the remote server. You then add a ":" followed by the directory path and file name on the remote server, e.g., /somedir/table. Then add a space and the location to which you want to copy the file.

How do you resume a stalled scp?

Another possibility is to try to salvage the scp you've already started when it stalls. ctrl+z to background and stop it, then ssh over to the receiving server and login, then exit. Now fg the scp process and watch it resume from 'stalled'!


2 Answers

You need the ip of the other pc and do:

scp user@ip_of_remote_pc:/home/user/stuff.php /Users/djorge/Desktop 

it will ask you for 'user's password on the other pc.

like image 105
Snake Avatar answered Oct 21 '22 18:10

Snake


There must be a user in the AllowUsers section, in the config file /etc/ssh/ssh_config, in the remote machine. You might have to restart sshd after editing the config file.

And then you can copy for example the file "test.txt" from a remote host to the local host

scp [email protected]:test.txt /local/dir


@cool_cs you can user ~ symbol ~/Users/djorge/Desktop if it's your home dir.

In UNIX, absolute paths must start with '/'.

like image 41
0xAX Avatar answered Oct 21 '22 19:10

0xAX