如何生成SSH key
一:生成KEY
在终端中输入:ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key重新建立ssh_host_dsa_key文件
以下是返回信息
Generating public/private dsa key pair.
Enter passphrase (empty for no passphrase):(直接回车)
Enter same passphrase again:
Your identification has been saved in /etc/ssh/ssh_host_dsa_key.
Your public key has been saved in /etc/ssh/ssh_host_dsa_key.pub.
The key fingerprint is:
xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx root@localhost.localdomain
在终端中输入:ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key重新建立ssh_host_rsa_key文件
以下是返回信息
Generating public/private rkey pair.
Enter passphrase (empty for no passphrase):(直接回车)
Enter same passphrase again:
Your identification has been saved in /etc/ssh/ssh_host_rsa_key.
Your public key has been saved in /etc/ssh/ssh_host_dsa_rey.pub.
二
key生成在目录/etc/ssh
没有.ssh目录的话手动创建,注意,它的目录权限是700
cat ssh_host_dsa_key.pub >> /root/.ssh/authorized_keys
ssh_host_dsa_rey这个放到客户端
/etc/ssh/sshd_config配置如下
Port 22
PubkeyAuthentication yes
AuthorizedKeysFile /root/.ssh/authorized_keys
PasswordAuthentication no /*禁止密码验证登录
如何生成SSH key
首先安装git客户端,然后用命令生成。。
Administrator@xxxx-pc MINGW64 ~/.ssh
$ git config --global user.name "xuliang09"
Administrator@xxxx-pc MINGW64 ~/.ssh
$ git config --global user.email "xuliang09@xxxx.cn"
Administrator@xxxx-pc MINGW64 ~/.ssh
$ ssh-keygen -t rsa -C "xuliang09@xxxx.cn"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa): 设置密码在这里输入
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
三次回车,密码为空
Administrator@xxxx-pc MINGW64 ~/.ssh

