在CENTOS6下面, 若需要SSH可以无密码访问, 可以做如下处理
1、产生密码,本例是在主机151上执行
ssh-keygen -f /var/lib/pgsql/.ssh/id_rsa -N ''
[root@pg1 ~]# ssh-keygen -f /var/lib/pgsql/.ssh/id_rsa -N ''
Generating public/private rsa key pair.
/var/lib/pgsql/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Your identification has been saved in /var/lib/pgsql/.ssh/id_rsa.
Your public key has been saved in /var/lib/pgsql/.ssh/id_rsa.pub.
The key fingerprint is:
f9:e5:7e:a6:17:3a:ff:29:db:ae:83:67:98:2e:bc:af root@pg1.localdomain
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| |
| . |
| S . |
| . o . |
| . . =. . |
| o =o== .|
| E*o=XB=.|
+-----------------+
2、将密码复制到想访问的远程主机
本例将151的公钥复制到150和152
[root@pg1 ~]# ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.35.150
Now try logging into the machine, with "ssh 'root@192.168.35.150'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
[root@pg1 ~]# ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.35.152
root@192.168.35.152's password:
Now try logging into the machine, with "ssh 'root@192.168.35.152'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
3、完成, 验证
引用
[root@pg0 ~]# ssh pg1
Last login: Wed Jan 14 14:31:08 2015 from 192.168.35.150
[root@pg1 ~]# ssh pg2
Last login: Wed Jan 14 14:31:10 2015 from 192.168.35.151
经验证可以正常访问
另外如果端口不是默认的22, 需要加访问端口
引用
ssh-copy-id -i /root/.ssh/id_rsa.pub "root@192.168.35.150 -p 242"
分享到:
相关推荐
ssh免密配置,在配置中遇到各种坑导致配置不成功,后面把遇到的问题都总结了下,理出清晰的思路,能够应付常见免密配置坑,适合经验不是十分丰富的人员借鉴(因为重点给出了一些解决思路)。
centos7 ssh8.6和ssl1.1.1k rpm安装包
最近项目要求数据传必须使用sftp,但sftp又不能直接使用22端口,不安全,网上查询的ssh和sftp分离相关的资料都是基于centos7的,于是经过研究尝试,完成了基于centos6版本的服务分离
centos之SSH安装centos之SSH安装centos之SSH安装centos之SSH安装
Centoe 下linux远程桌面描述 ,Centos远程 SSH登录
对于linux 的远程管理来说 ssh是非常重要的东西。 如何进行安全保护,是我们管理员要掌握的一项技能
centos6跟7相关gcc的依赖包以及安装ssh相关依赖的源码包,有gcc-4.8.5-44.el7.x86_64.rpm,glibc-devel-2.17-317.el7.x86_64.rpm,pam-1.1.1-22.el6.x86_64.rpm,pam-devel-1.1.1-22.el6.x86_64.rpm,Linux-PAM-...
Windows7配置PuTTY+Xming连接CentOS7 SSH服务器图形化界面.........
服务器Centos集群上实现ssh无密码相互访问,解决bash scp command not found问题
centOS 下SSH常用命令!
CentOS 6.5之SSH免密码登录配置.docx 自己亲自试验,按文档安装
VMware中建立centos系统,两个centos系统实现免密码登陆,源码截图,亲自实现。
主要给大家介绍了关于centos配置ssh免密码登录后仍要输入密码的解决方法,需要的朋友可以参考下
由于centos默认远程端口22,服务器远程部署修改ssh端口号
在CentOS7下,设置ssh自启动,修改ssh监听端口
centos6 ssh8.3p1的升级文件,升级步骤非常简单,执行sshupdate1.sh就行
shell+expect编写的 大数据集群ssh免密登录自动化配置脚本(带说明文档)
资源里面的内容有:pcre-7.8-6.el6.x86_64.rpm 加上说明文档:里面有各种版本下载地址。我的系统是linux centos 6
centos6系统的 openssh8.4p1 rpm包,包含安装脚本,解压后,上传服务器同一目录,脚本赋予执行权限,执行脚本即可。
SSH 为 Secure Shell 的缩写,由 IETF 的网络工作小组(Network Working Group)所制定;SSH 为建立在应用层和传输层基础上的安全协议。 传统的网络服务程序,如FTP、POP和Telnet其本质上都是不安全的;因为它们在...