[root@node1 ~]$ yum install -y openssh-server # 安装openssh服务端 [root@node1 ~]$ yum install -y openssh-clients #安装openssh客户端,可以不安装 [root@node1 ~]$ service sshd start # 临时开启sshd服务 [root@node1 ~]$ chkconfig sshd on # 永久开启sshd服务,服务器重启也生效 [root@node1 ~]$service sshd status # 查看sshd服务运行状态 openssh-daemon (pid 1384) 正在运行... # 显示正在运行
[root@node1 ~]$ (umask 0077; ssh-keygen) # 生成ssh密钥对,并将权限设置为600 Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): # 回车 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: fd:72:10:50:a6:7d:83:c7:93:d2:26:3d:12:0e:38:2f root@node1 The key's randomart image is: +--[ RSA 2048]----+ | .o.+ | | o B * . | | o. O % | | E .. O + | | .S o | | o | | . o | | o | | | +-----------------+ [root@node1 ~]$ cd .ssh/ [root@node1 .ssh]$ ll # 查看密钥/公钥对信息,权限都为600 总用量 8 -rw-------. 1 root root 1675 5月 21 14:26 id_rsa # 私钥 -rw-------. 1 root root 392 5月 21 14:26 id_rsa.pub # 公钥 [root@node1 .ssh]$
PasswordAuthentication no # 不允许密码验证登录 PubkeyAuthentication yes # 允许公钥验证登录 AuthorizedKeysFile .ssh/id_rsa.pub # 指定公钥文件路径
#]sz id_rsa #]sz id_rsa.pub
[root@node1 .ssh]$ service sshd reload 重新载入 sshd: [确定]
ssh root@IP
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有