这篇文章主要介绍“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免密码登录”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注创新互联-成都网站建设公司网站,小编会继续努力为大家带来更多实用的文章!