linux生成ssh公私钥
文件/etc/ssh/sshd_config 里面如下配置注释去掉
PasswordAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
[root@s18vn-gmt-new ~]# vim /etc/ssh/sshd_config
[root@s18vn-gmt-new ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory ‘/root/.ssh’.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:2f/1LdKJaIOST6VxFhhtTzGodSZj+S91UP2CuIKIr6A root@s18vn-gmt-new
The key’s randomart image is:
+—[RSA 2048]—-+
| .. oo. .o|
| oX +.. .|
| .=.X . ..|
| .o..+ o o|
| . . .S =. o o |
| . . . .*… . |
|. . .oo ..+ ..|
|.. . o.. + o.+.o|
|E .. o.. . …o|
+—-[SHA256]—–+
[root@s18vn-gmt-new ~]# cd .ssh/
[root@s18vn-gmt-new .ssh]# ls
id_rsa id_rsa.pub
[root@s18vn-gmt-new .ssh]# cat id_rsa.pub >> authorized_keys
[root@s18vn-gmt-new .ssh]# service sshd restart
其中id_rsa下载或者cat 命令查看复制到本地创建文件 ,进行远程
近期评论