简体   繁体   English

尝试连接 SSH 获得权限被拒绝(公钥)

[英]Trying connect SSH get Permission denied (publickey)

I'm trying to connect to my server where I have Magento installed.我正在尝试连接到安装了 Magento 的服务器。 I loaded the key on my windows cmd with ssh-add, and then connected with:我用 ssh-add 在我的 windows cmd 上加载了密钥,然后连接:

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'我无法在 windows 上运行 chmod 600 并且已经检查了密钥文件的权限并且是“完全控制”

A permission denied, as commented, means SSH does connect, but does not find the right public key to validate the private one used locally.如评论所述,权限被拒绝意味着 SSH 确实连接,但找不到正确的公钥来验证本地使用的私钥。

Try ssh -Tv -pPORT user@server to see what key is used locally.试试ssh -Tv -pPORT user@server看看本地用的是什么密钥。

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)然后确保将您的公钥复制到远程服务器,在~user/.ssh/id_rsa.pub中(用您需要的实际用户帐户名替换“用户”)

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.这将要求您第一次输入用户密码,但随后会将您的公钥复制到主机/服务器上,以便在您下次登录时允许基于密钥的身份验证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 推送到现有项目时出现SSH错误权限被拒绝(publickey) - SSH error on push to an existing project Permission denied (publickey) 不能克隆,可以SSH。 “权限被拒绝(公钥)。” - Can't clone, can SSH. “Permission denied (publickey).” 尝试从GitHub克隆时权限被拒绝(publickey)错误 - Permission denied (publickey) error when trying to clone from GitHub 对于 ssh 连接,在 Anaconda、Windows 中出现错误“无法加载密钥 ----,格式无效,权限被拒绝(公钥)” - For ssh connection, getting error "Failed to load key ----, invalid format, Permission denied (publickey)" in Anaconda, Windows 在Windows 8上拒绝使用SSH连接到Amazon EC2的权限 - Permission denied to connect to Amazon EC2 using SSH at Windows 8 IntelliJ IDEA git 权限被拒绝(公钥) - IntelliJ IDEA git Permission denied (publickey) Windows 上的 Git [权限被拒绝(公钥)] 的 Jenkins 问题 - Jenkins issue with Git [Permission denied (publickey).] on Windows 权限被拒绝(公钥)-用Git不能推入或拉出 - Permission denied (publickey) - Cant push or pull with Git 设置 Jenkins 时权限被拒绝(公钥) - Permission denied (publickey) when setting up Jenkins 权限被拒绝-尝试建立Web连接时使用connect(2) - Permission denied - connect(2) when trying to establish a web connection
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM