安全 Shell (SSH)是最通用的系统管理工具之一。它允许登录远程系统并在其上执行命令。 它利用强大的加密技术和主机密钥来防止网络嗅探。他是默认启用的唯一网络服务,并且接 受远程访问。 X 选项 可使远程主机上的程序在本地桌面环境下显示图形界面。这带来了便利,而且为本 地主机与远程主机之间的通信通道提供了保护
[root@localhost ~]# ssh 192.168.1.1 The authenticity of host '192.168.1.1 (192.168.1.1)'can't beestablished. RSA key fingerprintis83:8f:76:3a:42:31:b0:95:49:72:8a:a7:1c:39:08:e6. Are you sure you want to continue connecting (yes/no)?yes Warning: Permanently added '192.168.1.1' (RSA) to thelist of knownhosts. root@192.168.1.1's password: Last login: Sun Aug 28 22:05:29 2011 [root@station1 ~]#
[root@localhost ~]# ssh user1@192.168.1.1 user1@192.168.1.1's password: Last login: Fri Jun 17 01:11:57 2011 from 192.168.1.254 [user1@station1 ~]$
可以使用ssh-keygen 命令生成密钥 [root@localhost ~]# ssh-keygen -t rsa Generating public/private rsa key pair. Enterfile in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): 123456 Enter same passphrase again: 123456 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: 0c:cf:fc:b0:e3:00:5a:dd:6d:7b:1d:af:9c:8b:05:86root@localhost.localdomain
可以使用ssh-copy-id 将自己的公钥复制到目标系统 [root@localhost ~]# ssh-copy-id -i ~/.ssh/id_rsa.pubuser1@192.168.1.1 user1@192.168.1.1's password: Now try logging into the machine, with "ssh'user1@192.168.1.1'", and checkin: .ssh/authorized_key [root@localhost ~]# ssh user1@192.168.1.1 Last login: Tue Sep 6 10:50:26 2011 from 192.168.1.254 [user1@station1 ~]$