ssh打通通道 推荐
2009-05-08 20:02
399 查看
用命令ssh-keygen -t rsa在serverA中生成密钥对,-t rsa表示采用RSA算法来生成密钥对.生成的密钥对默认存放在~/.ssh/目录中,id_rsa.pub中存放公钥,id_rsa存放私钥.
(注:在生成密钥对的时候系统会提示输入密钥对的密码,这里请直接回车,不要输入密码,否则后面打通通道之后仍然需要密码,只不过是用这里设置的密码而已)
将id_rsa.pub中的公钥拷贝出来,追加到serverB中的~/.ssh/authorized_keys文件中.
本机ssh打通自己:
zj@debian-zj:~/repos$ cd ~
zj@debian-zj:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/zj/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/zj/.ssh/id_rsa.
Your public key has been saved in /home/zj/.ssh/id_rsa.pub.
The key fingerprint is:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX zj@debian-zj
The key's randomart image is:
+--[ RSA 2048]----+
| xxxxxxxxxx |
| xxxxxxxxxx |
| xxxxxxxxxxx |
| xxxxxxxxxxxx |
| xxxxxxxxxxxx |
| xxxxxxxxxxx |
|xxxxxxxxxxxx |
|xxxxxx |
|xxxx |
+-----------------+
zj@debian-zj:~$ cd ~/.ssh
zj@debian-zj:~/.ssh$ ls
id_rsa id_rsa.pub known_hosts
zj@debian-zj:~/.ssh$ touch authorized_keys
zj@debian-zj:~/.ssh$ cat id_rsa.pub > authorized_keys
test:
zj@debian-zj:~/.ssh$ ssh 127.0.0.1
Linux debian-zj 2.6.26-1-686 #1 SMP Fri Mar 13 18:08:45 UTC 2009 i686
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
You have new mail.
zj@debian-zj:~$ exit
logout
Connection to 127.0.0.1 closed.
zj@debian-zj:~/.ssh$
说明:
authorized_keys文件的权限很重要,如果设置为777,那么登录的时候,还是需要提供密码的。
chmod 400 authorized_keys
(注:在生成密钥对的时候系统会提示输入密钥对的密码,这里请直接回车,不要输入密码,否则后面打通通道之后仍然需要密码,只不过是用这里设置的密码而已)
将id_rsa.pub中的公钥拷贝出来,追加到serverB中的~/.ssh/authorized_keys文件中.
本机ssh打通自己:
zj@debian-zj:~/repos$ cd ~
zj@debian-zj:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/zj/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/zj/.ssh/id_rsa.
Your public key has been saved in /home/zj/.ssh/id_rsa.pub.
The key fingerprint is:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX zj@debian-zj
The key's randomart image is:
+--[ RSA 2048]----+
| xxxxxxxxxx |
| xxxxxxxxxx |
| xxxxxxxxxxx |
| xxxxxxxxxxxx |
| xxxxxxxxxxxx |
| xxxxxxxxxxx |
|xxxxxxxxxxxx |
|xxxxxx |
|xxxx |
+-----------------+
zj@debian-zj:~$ cd ~/.ssh
zj@debian-zj:~/.ssh$ ls
id_rsa id_rsa.pub known_hosts
zj@debian-zj:~/.ssh$ touch authorized_keys
zj@debian-zj:~/.ssh$ cat id_rsa.pub > authorized_keys
test:
zj@debian-zj:~/.ssh$ ssh 127.0.0.1
Linux debian-zj 2.6.26-1-686 #1 SMP Fri Mar 13 18:08:45 UTC 2009 i686
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
You have new mail.
zj@debian-zj:~$ exit
logout
Connection to 127.0.0.1 closed.
zj@debian-zj:~/.ssh$
说明:
authorized_keys文件的权限很重要,如果设置为777,那么登录的时候,还是需要提供密码的。
chmod 400 authorized_keys
相关文章推荐
- [工具] 分布式系统下批量创建用户及分发公钥打通ssh通道的脚本
- ssh打通通道自动登录
- 通过ssh-keygen打通两台主机间通道
- 华为“4V”金字塔打通大数据价值通道 推荐
- pssh打通ssh通道
- ssh打通通道自动登录
- tty.js打通浏览器与Linux的通道
- 通过ssh通道实现linux登陆远程linux桌面
- 两台主机打通ssh
- 16GB 光纤通道-离现实有多远? 推荐
- 用TCP和TLS为即时通讯搭建通信通道 推荐
- 打通ssh的方法
- 推荐一款 chrome SSH 插件 - Secure Shell
- CDH5安装之:打通主节点到其他节点的ssh
- 通过SSH通道穿越防火墙访问内网的机器!
- 推荐使用集串口,SSH远程登录和FTP传输三合一工具MobaXterm
- RHCE课程-RH131Linux管理笔记五-Linux远程登陆telnet及ssh服务 推荐
- 深入浅出WPF(9)——数据的绿色通道,Binding(下) 推荐
- 是时候放弃putty了,推荐个putty的替代品:Xshell,Bitvise SSH Client
- 建立linux ssh信任及常见问题解决办法 推荐