linux下怎么设置ssh免密码登录
这篇文章主要介绍“linux下怎么设置ssh免密码登录”,在日常操作中,相信很多人在linux下怎么设置ssh免密码登录问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”linux下怎么设置ssh免密码登录”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
网站建设哪家好,找创新互联公司!专注于网页设计、网站建设、微信开发、小程序制作、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了丰城免费建站欢迎大家使用!
##linux7设置ssh免密码登录(密码变更后一样可以登录)
[root@rhel7 ~]$
ssh-keygen #生产密钥文件
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
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:
32:a8:b6:60:58:9e:c4:fe:eb:9d:69:d5:ff:3f:d1:3a root@rhel7
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| |
| . . |
| + . o S. .|
|.= o o. . ..|
|o.* . . ..|
|.o o ..o . E. |
| ..+o+ ..oo|
+-----------------+
[root@rhel7 ~]$
ssh-copy-id 192.168.32.128 #复制到其他服务器
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.32.128's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh '192.168.32.128'"
and check to make sure that only the key(s) you wanted were added.
[root@rhel7 ~]$
ssh 192.168.32.128 #免密码登录
Last login: Mon Nov 20 22:30:47 2017 from 192.168.32.100
[root@MySQL ~]# exit
logout
Connection to 192.168.32.128 closed.
[root@mysql ~]#
passwd
Changing password for user root.
New password:
BAD PASSWORD: it is based on a dictionary word
Retype new password:
passwd: all authentication tokens updated successfully.
[root@rhel7 ~]$
ssh 192.168.32.128 #变更root密码后,还是可以免密码登录.
Last login: Mon Nov 20 22:32:35 2017 from 192.168.32.100
到此,关于“linux下怎么设置ssh免密码登录”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注创新互联网站,小编会继续努力为大家带来更多实用的文章!
本文名称:linux下怎么设置ssh免密码登录
本文地址:http://hbruida.cn/article/jpgioo.html