简体   繁体   中英

Trying connect SSH get Permission denied (publickey)

I'm trying to connect to my server where I have Magento installed. I loaded the key on my windows cmd with ssh-add, and then connected with:

ssh -pPORT user@server

and I get:

Permission denied (publickey).

How can I fix this? I can't run chmod 600 on windows and already checked the permissions on the key file and are 'full control'

A permission denied, as commented, means SSH does connect, but does not find the right public key to validate the private one used locally.

Try ssh -Tv -pPORT user@server to see what key is used locally.

Then make sure your public key is copied to the remote server, in ~user/.ssh/id_rsa.pub (replace "user" by the actual user account name you need in your case)

This error usually means your key hasn't been added to the authorized keys list on the host machine. You can either manually add the public key to the server, or use the following command from the machine you're using to connect to the server.

ssh-copy-id -pPORT user@server

This will require you to enter the users password first time, but will then copy your public key onto the host/server to allow key based authentication next time you login.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM