Ubuntu 下 SSH 实现远程登录 无需输入密码
2014-09-04 16:25
676 查看
首先准备两台linux OS 的机子,这里用的是虚拟机
第一台:
chiwei@chiwei-VirtualBox:~$ hostname
chiwei-VirtualBox
IP:192.168.8.144
第二台:
chiwei@chiwei-hadoop:~/.ssh$ hostname
chiwei-hadoop
IP:192.168.8.200
分别在两台机子上安装openssh-server http://blog.csdn.net/simonchi/article/details/38871953 这里有说明
安装完成之后就可以使用SSH命令了
在第一台执行 ssh-keygen -t rsa
chiwei@chiwei-VirtualBox:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/chiwei/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/chiwei/.ssh/id_rsa.
Your public key has been saved in /home/chiwei/.ssh/id_rsa.pub.
The key fingerprint is:
1d:45:b5:a3:54:6e:a7:f6:65:79:27:9b:a6:1c:d4:d2 chiwei@chiwei-VirtualBox
The key's randomart image is:
+--[ RSA 2048]----+
| .o.o |
| . o . |
| . . = .|
| . o = +.|
| S . + E.=|
| . o *+|
| . + .|
| . + |
| o |
+-----------------+
执行 cp id_rsa.pub authorized_keys
执行
chiwei@chiwei-VirtualBox:~/.ssh$ scp authorized_keys chiwei@chiwei-hadoop:/home/chiwei/.ssh
chiwei@chiwei-hadoop's password:
authorized_keys 100% 406 0.4KB/s 00:00
chiwei@chiwei-VirtualBox:~/.ssh$ ssh chiwei-hadoop
Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-24-generic x86_64)
* Documentation: https://help.ubuntu.com/
359 packages can be updated.
6 updates are security updates.
到第二台机子去查看
chiwei@chiwei-hadoop:~/.ssh$ ls
authorized_keys id_rsa id_rsa.pub
chiwei@chiwei-hadoop:~/.ssh$
已经文件传过来了
现在在第一台机子直接ssh 第二台主机 就可以直接登录了
第一台:
chiwei@chiwei-VirtualBox:~$ hostname
chiwei-VirtualBox
IP:192.168.8.144
第二台:
chiwei@chiwei-hadoop:~/.ssh$ hostname
chiwei-hadoop
IP:192.168.8.200
分别在两台机子上安装openssh-server http://blog.csdn.net/simonchi/article/details/38871953 这里有说明
安装完成之后就可以使用SSH命令了
在第一台执行 ssh-keygen -t rsa
chiwei@chiwei-VirtualBox:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/chiwei/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/chiwei/.ssh/id_rsa.
Your public key has been saved in /home/chiwei/.ssh/id_rsa.pub.
The key fingerprint is:
1d:45:b5:a3:54:6e:a7:f6:65:79:27:9b:a6:1c:d4:d2 chiwei@chiwei-VirtualBox
The key's randomart image is:
+--[ RSA 2048]----+
| .o.o |
| . o . |
| . . = .|
| . o = +.|
| S . + E.=|
| . o *+|
| . + .|
| . + |
| o |
+-----------------+
执行 cp id_rsa.pub authorized_keys
执行
chiwei@chiwei-VirtualBox:~/.ssh$ scp authorized_keys chiwei@chiwei-hadoop:/home/chiwei/.ssh
chiwei@chiwei-hadoop's password:
authorized_keys 100% 406 0.4KB/s 00:00
chiwei@chiwei-VirtualBox:~/.ssh$ ssh chiwei-hadoop
Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-24-generic x86_64)
* Documentation: https://help.ubuntu.com/
359 packages can be updated.
6 updates are security updates.
到第二台机子去查看
chiwei@chiwei-hadoop:~/.ssh$ ls
authorized_keys id_rsa id_rsa.pub
chiwei@chiwei-hadoop:~/.ssh$
已经文件传过来了
现在在第一台机子直接ssh 第二台主机 就可以直接登录了
相关文章推荐
- 【Linux学习笔记】Linux主机如何实现无需输入密码的远程登录或脚本远程执行
- RHCE_LAB(2)SSH远程登录自动验证(不输入用户登录密码)的实现
- ssh远程登录时实现不输入密码
- RHCE_LAB(2)SSH远程登录自动验证(不输入用户登录密码)的实现
- SSH远程登录无需输入密码
- 使用expect实现ssh不输入密码登录远程服务器
- Ubuntu下SSH设置,实现远程登录
- ssh(ssh-keygen)配置免输入密码登录远程主机的方法
- ubuntu下实现sudo无需输入密码
- 配置ssh agent远程登录不用输入密码
- 通过PuTTY使用SSH免密码登录Ubuntu Server14.04远程服务器
- SSH无密码登录远程主机(cygwin --> Ubuntu)
- ubuntu下ssh连接设置无密码登录后依然需要输入密码
- ubuntu实现远程登录——ssh服务
- 解决在iOS开发的代码中实现scp的ssh远程连接,怎么输入密码问题
- SSH使用ssh-keygen 远程登录主机免输入密码
- linux下 ssh 实现无需密码的远程登陆
- 不输入密码,ssh直接登录远程Linux主机
- CentOS6.3上SSH远程登录实现无密码认证
- SSH使用ssh-keygen远程登录主机免输入密码