I'm trying to set up public key authentication on a CentOS 7.3 guest, using WSL.

When trying to copy the public key using ssh-copy-id, it's rejected, saying it already exists on the VM. This is not the case, since it's a fresh install, and there isn't even an .ssh directory in /root.

After searching around, wrong file permissions seems to be a possible error, so I ran these commands:


chmod go-w ~


chmod go-w ~
chmod 0700 ~/.ssh
chmod 0600 ~/.ssh/config
chmod 0600 ~/.ssh/id_rsa
chmod 0644 ~/.ssh/id_rsa.pub
chmod 0600 ~/.ssh/known_hosts

On the server in sshd_config public key authentication is enabled. The result of ssh-copy-id was the same.

However when I ran ssh-copy-id -o "LogLevel VERBOSE" root@ip it prompted me for the password, and then successfully copied over the key. After which I could use ssh root@ip, and successfully authenticate using my key.

ssh using password authentication worked the whole time.

Why didn't it work with normal ssh-copy-id, but it did using ssh-copy-id -o "LogLevel VERBOSE"?

What did I miss?


Verbose is not needed. INFO log level is enough, as it is already fixed in the upstream repository.

Commit message explains it pretty much:

the LogLevel is set to 'None' we'll not get the Permission Denied we're looking for.

This is not a problem in default configuration (since default value is INFO as per manual page). The problem occurs only if you set the LogLevel=QUIET in some of your configuration files (which is pretty much never what you want, unless you are sure that it the connection will succeed or you don't care if it does).

  • The LogLevel was set to QUIET in my .ssh/config file. Thank you, it works fine if I remove that line. – Daniel Szabo Dec 20 '16 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.