1.安装
lord@dell:~$ sudo apt-get install ssh
2设置无密码登录
lord@dell:~$ ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
Generating public/private dsa key pair.
Your identification has been saved in /home/lord/.ssh/id_dsa.
Your public key has been saved in /home/lord/.ssh/id_dsa.pub.
The key fingerprint is:
c6:82:68:e8:e0:d2:93:b5:51:70:16:f6:6a:fa:41:66 lord@dell
The key's randomart image is:
+--[ DSA 1024]----+
| . =. |
| = . |
| . . |
| . . o o |
|o o + E S |
|+o o O o |
|.o+ o . |
|. . . . |
| . |
+-----------------+
lord@dell:~$
ssh-keygen是生成密钥的命令
-t 密钥类型参数,dsa是一种密钥类型
-P密钥参数 ,设置为 ‘’
~是当前用户的意思,我的实验环境用户名为lord
由上图命令及结果可以看出 身份信息存入到了/home/lord/.ssh/id_dsa下,公钥存入/home/lord/.ssh/id_dsa.pub
(如何查看这些文件?.ssh文件为隐藏文件夹,Ctrl + H可以显示隐藏文件夹)
3.验证安装
lord@dell:~$ ssh -version
OpenSSH_5.8p1 Debian-7ubuntu1, OpenSSL 1.0.0e 6 Sep 2011
Bad escape character 'rsion'.
lord@dell:~$
lord@dell:~$ ssh localhost
lord@localhost's password:
Welcome to Ubuntu 11.10 (GNU/Linux 3.0.0-12-generic i686)
* Documentation: https://help.ubuntu.com/
Last login: Wed Nov 16 14:14:38 2011 from localhost
lord@dell:~$