use*_*975 60 unix ssh ssh-keys
我有几个客户端系统,我需要推送ssh密钥并从我的服务器登录而无需身份验证提示.
首先,在服务器上,我创建了ssh密钥,如下所示,这是成功的
]# ssh-keygen -t rsa -N "" -f my.key
Run Code Online (Sandbox Code Playgroud)
其次,尝试复制pub键但失败,没有身份错误.我在这里做错了吗?
]# ssh-copy-id my.key.pub 10.10.1.1
/usr/bin/ssh-copy-id: ERROR: No identities found
Run Code Online (Sandbox Code Playgroud)
Jos*_*lly 55
你需要使用-i标志:
ssh-copy-id -i my.key.pub 10.10.1.1
Run Code Online (Sandbox Code Playgroud)
从手册页:
如果给出-i选项,则使用身份文件(默认为〜/ .ssh/id_rsa.pub),无论ssh-agent中是否有任何键.否则,如果这样:ssh-add -L提供任何输出,它会优先使用它来识别身份文件
SMS*_*MSM 26
运行以下命令
# ssh-add
Run Code Online (Sandbox Code Playgroud)
如果它出现以下错误:无法打开与身份验证代理的连接
要删除此错误,请运行以下命令:
# eval `ssh-agent`
Run Code Online (Sandbox Code Playgroud)
小智 24
在客户端生成ssh密钥为我解决了它
$ ssh-keygen -t rsa
Run Code Online (Sandbox Code Playgroud)
小智 15
最简单的方法是:
ssh-keygen
[enter]
[enter]
[enter]
cd ~/.ssh
ssh-copy-id -i id_rsa.pub USERNAME@SERVERTARGET
Run Code Online (Sandbox Code Playgroud)
阿特:
它非常非常简单。
在“ss-keygen”手册中解释:
"DESCRIPTION ssh-keygen 为 ssh(1) 生成、管理和转换认证密钥。ssh-keygen 可以创建供 SSH 协议版本 1 使用的 RSA 密钥和供 SSH 协议版本 2 使用的 DSA、ECDSA 或 RSA 密钥。使用 -t 选项指定要生成的密钥。 如果不带任何参数调用,ssh-keygen 将生成一个 RSA 密钥,用于 SSH 协议 2 连接。 ”
ssh-copy-id无法找到系统中ssh-keygen生成的id_rsa.pub文件,请使用以下命令完成:
locate *.pubssh-copy-id -i /home/user_name/.ssh/id_rsa.pub hostname小智 6
Old post but I came up with this problem today, ended up googling and had found myself here. I had figured it out on my own but thought I'd share my issue & solution in my case to help out anyone else who may have the same issue.
Issue:
[root@centos [username]]# ssh-keygen -t rsa
Run Code Online (Sandbox Code Playgroud)
Enter file in which to save the key (/root/.ssh/id_rsa):I HAD JUST HIT ENTER
/usr/bin/ssh-copy-id: ERROR: No identities found
Run Code Online (Sandbox Code Playgroud)
Solution:
Enter file in which to save the key (/root/.ssh/id_rsa): **/home/[username]/id_rsa**
Run Code Online (Sandbox Code Playgroud)
Be sure if you are doing this as root you are coping the key into the user directory you wish to login with. NOT the root user directory.
执行此操作时,我正在 SSH 到机器中,所以我猜 ssh-copy-id 只是指向您默认登录的目录。
希望这可以帮助任何人。
在使用我从其他地方手动复制的私钥的现有帐户上遇到了这个。所以错误是因为缺少公钥
所以只需从私人生成一个
ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
Run Code Online (Sandbox Code Playgroud)
您需要使用-i选项指定密钥。
ssh-copy-id -i your_public_key user@host
Run Code Online (Sandbox Code Playgroud)
谢谢。