今天在闲逛www.cpan.org时,发现了一个懒人运维之宝的脚本-Linux远程连接快捷方式(remote-ssh-access)。且听我慢慢道来:
1.官方描述:remote-ssh-access - An application for creating handy SSH client shortcut.
2.懒人解释:大家都用过windows下面的远程桌面连接吧。在有多台windows机器时,我常常会利用远程桌面连接的选项设置直接保存为快捷方式。下次连接时,我们就不需要在输入用户名和密码直接双击刚刚保存的快捷方式。remote-ssh-access在Linux下面创建远程登录的软连接,下次登录时只需要执行刚刚新建的软软件就可以自动登录到远程Linux主机。
3.下载:http://cpan.hexten.net/authors/id/L/LD/LDAVIS/remote-ssh-access-1.5
4.用法举例:
- 生成ssh密钥文件:
$ssh-keygen- 传输密钥到目标主机(要自动登录的主机)
$ssh-copy-id -i ~/.ssh/id_rsa.pub root@{you host}- 创建快捷方式
[root@192.168.1.1 .hosts]# ./remote-ssh-access --add
*** Entering input loop: your valid non-data input commands are: `back', `exit' or `quit'
Hostname --> 192.168.1.2
Username [EMPTY=All users] --> root
Port [EMPTY=22] --> 22
Public Key [EMPTY=Default key] --> id_rsa
Version --> 2
Command [EMPTY=Login shell] --> id
Shortcut -->
***: field 'short' is required
Shortcut --> hello_root
The shortcut '121_root' has been created.
[root@192.168.1.1 .hosts]# ls
192.168.1.2:root:22:id_rsa:2:id hello_root remote-ssh-access- 快捷方式登录
$hello_root
/usr/bin/ssh -2 -p 22-i /root/.ssh/id_rsa -l root 192.168.1.2
Last login: Tue Mar 23 16:12:48 2010 from 192.168.1.1- 为了更快捷
export PATH=$PATH:/root/.host/