I'm trying to copy files from one server to another with scp.
On both servers, I configured ssh port to 222. sshd_config for both servers is exactly the same (no RootLogin, PasswordAuthentication enabled)
For many reasons too long to explain here, I can't use key authentication.
When I use scp to copy from server A to server B (logged to A), it works. But it doesn't work when I'm doing the same thing from B to A (logged to B) : I get an error message "permission denied" and scp doesn't ask me for password (although the password authentication is enabled)
Here is the command I use (logged on server B) :
scp -P 222 -vvv ~/backup/file user@serverA:/home/user/backup
And here are the last lines of the output :
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: password
debug3: start over, passed a different list password
debug3: preferred publickey,keyboard-interactive
debug1: No more authentication methods to try.
user@serverA: Permission denied (password).
Why doesn't scp ask me for password, whereas "password" is enabled (as it is written in the 2nd "debug1" line) ?
Thank you.
Best Answer
The best solution would be to ask the person who disabled
publickey
authentication on that server why and then go fix that. Usingpublickey
authentication is more convenient and more secure than passwords.The reason authentication fails for you is that no authentication method is enabled on both client and server. The authentication methods enabled on the server are:
And the authentication methods enabled on the client are:
You can pass
-o PreferredAuthentications=password
toscp
to only usepassword
authentication.