linux免密码互相登录
2016-05-27 13:01
232 查看
系统:CentOS6.7
1.用ssh-key-gen在本地主机上创建公钥和私钥
ssh-keygen -t rsa
一路回车,注意第一个回车的位置是问你公钥和私钥的存储目录,我的机器是/root/.ssh
Enter file in which to save the key (/root/.ssh/id_rsa):
完成后在/root/.ssh下会创建两个文件,分别为公钥id_rsa.pub和私钥id_rsa
2.用ssh-copy-id把公钥复制到远程主机上
ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.1.103
输入yes
输入远程主机的密码
完成
这个命令会把密钥追加到远程主机的/root/.ssh/authorized_key上,并给.ssh目录和authorized_keys设置合适的权限
3.直接登录远程主机
ssh 192.168.1.103
ssh将不会询问密码
4.登出
logout
1.用ssh-key-gen在本地主机上创建公钥和私钥
ssh-keygen -t rsa
一路回车,注意第一个回车的位置是问你公钥和私钥的存储目录,我的机器是/root/.ssh
Enter file in which to save the key (/root/.ssh/id_rsa):
完成后在/root/.ssh下会创建两个文件,分别为公钥id_rsa.pub和私钥id_rsa
2.用ssh-copy-id把公钥复制到远程主机上
ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.1.103
输入yes
输入远程主机的密码
完成
这个命令会把密钥追加到远程主机的/root/.ssh/authorized_key上,并给.ssh目录和authorized_keys设置合适的权限
3.直接登录远程主机
ssh 192.168.1.103
ssh将不会询问密码
4.登出
logout
相关文章推荐
- Linux socket 初步
- Linux Kernel 4.0 RC5 发布!
- linux lsof详解
- linux 文件权限
- Linux 执行数学运算
- 10 篇对初学者和专家都有用的 Linux 命令教程
- Linux 与 Windows 对UNICODE 的处理方式
- Ubuntu12.04下QQ完美走起啊!走起啊!有木有啊!
- 解決Linux下Android开发真机调试设备不被识别问题
- 运维入门
- 运维提升
- Linux 自检和 SystemTap
- OpenSSL编程之RSA
- Centos6 编译安装Python
- Ubuntu Linux使用体验
- 每 172 个活动 RSA 证书中就有一个容易受到攻击
- c语言实现hashmap(转载)