Score:2

Moving files with rsync and custom port results in permission denied

jp flag

I'm trying to move some files between servers with rsync and non-standard SSH port. I can login when I just use ssh and supply my password. When I try with rsync I get permission denied. I'm not sure what I'm doing wrong.

This works:

ssh -p 1234 [email protected]

This doesn't:

rsync -azvhP -e "ssh -p 1234" --remove-sent-files /path/to/source/ [email protected]:/path/to/destination/

> Permission denied, please try again.

As a test with scp, this seems to work:

scp -rp -P 1234 /path/to/source/ [email protected]:/path/to/destination/

Any ideas on what's going on or how to troubleshoot?

Note: I also tried saving the options in my ~/.ssh/config

Host my-server
  HostName 192.168.0.123
  Port 1234
  User me

Then tried to rsync with Host friendly name which seems to yield identical results (i.e. asks for password, then errors permission denied).

rsync path/to/source my-server:/path/to/destination
[email protected]'s password:
Permission denied, please try again.
Score:0
jp flag

You are overriding a username to log into the destination host with [email protected]. You need to override it in the ssh command too - ssh -p 1234 -l me

jp flag
I tried as you suggested `rsync -azvhP -e "ssh -p 1234 -l me" ...` however I still get permission denied.
jp flag
Check the logs on the target server.
jp flag
Perhaps I'm looking at the logs incorrectly, but I only see a log entry when I purposely try an incorrect password. `User [me] from [192.168.0.123] failed to log in via [SSH] due to authorization failure.` When I use the correct password, I'll see permission denied in the terminal, but no log on the target server.
jp flag
Are you using a password to authenticate? How do you pass the password to `rsync`?
jp flag
Yes, I'm just using a password for authentication. Basically, after I run `rsync` in the terminal, it prompts me for the password: `[email protected]'s password: Permission denied, please try again.` (I've updated above for more clarity)
Score:0
jp flag

I figured it out. The server I was connecting to needed the rsync service to be enabled first. I just would have thought if SSH worked rsync would too. TIL

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.