47

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
cool_cs
  • 1,661
  • 6
  • 20
  • 26
  • 2
    Where exactly are you running this command? On the remote machine? or your local one? If it's on the local machine, you're basically just doing a local file copy. If you have no password locally, then reverse the order of the directives and run it locally, so it's your local machine initiating the copy, and logging into the remote one, rather than vice versa. – Marc B May 31 '12 at 17:39

2 Answers2

56

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.

Ashwini Chaudhary
  • 244,495
  • 58
  • 464
  • 504
Snake
  • 785
  • 1
  • 5
  • 13
19

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 your_username@remotehost.com: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 '/'.

kaspiotr
  • 558
  • 1
  • 9
  • 11
0xAX
  • 20,957
  • 26
  • 117
  • 206
  • Whenever I do this, it can't find my directory on my local machine. I am connected to the remote host and it can't find /local/dir or in my case Users/jorge/Desktop – cool_cs May 31 '12 at 17:51
  • @cool_cs you need to exit ssh and run scp from your local machine – chim Nov 06 '14 at 11:09