23

I am trying scp -r usernameipaddress:/path /pathwhereIwanttocopy, but I am getting it as connection refused.

How can I get it? How can I get connected?

Nilesh Agrawal
  • 3,002
  • 10
  • 26
  • 54

3 Answers3

46

The -r flag should work. In your example you seem to be forgetting the name of the folder you want to copy. Try:

scp -r nameOfFolderToCopy username@ipaddress:/path/to/copy/

to copy a folder from your local computer to a remote one. Or

scp -r username@ipaddress:/path/of/folder/to/copy /target/local/directory

to copy a folder from a remote machine to your local one.

Memento Mori
  • 3,327
  • 2
  • 22
  • 29
2

You may also want to check out rsync. It has lots of options for handling duplicates, permissions etc.

rsync -r username@computer:/path/to/source /path/to/dest

or for upload

rsync -r /path/to/source username@computer:/path/to/dest
user000001
  • 32,226
  • 12
  • 81
  • 108
1

If you have a folder called working in your user directory, all you need is:

scp -r username@ipaddress:working ./

It's likely you'll get "Permission Denied" with this:

scp -r username@ipaddress:/working ./

Can you check to see if the ssh service is running on the remote machine? If you can login, try:

ps -aux | grep sshd
Steve
  • 51,466
  • 13
  • 89
  • 103