Linux下OpenSSH的安装和配置祥解

清风了了 2007-04-19

Openssh的安装和启动
tony@tonybox:~$ sudo aptitude update
tony@tonybox:~$ sudo aptitude install openssh-server
Reading package lists... Done
Building dependency tree... Done
Reading extended state information
Initializing package states... Done
Reading task descriptions... Done
Building tag database... Done
The following NEW packages will be automatically installed:
libedit2 openssh-client
The following NEW packages will be installed:
libedit2 openssh-client openssh-server
0 packages upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 55.4kB/879kB of archives. After unpacking 2130kB will be used.
Do you want to continue? [Y/n/?]y
...
Setting up openssh-server (4.3p2-5) ...
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
Restarting OpenBSD Secure Shell server: sshd.
//创建服务器RSA/DSA密钥对
tony@tonybox:~$
安装完毕后默认生成以下配制文件:
tony@tonybox:~$ ls /etc/ssh -l
total 160
-rw-r--r-- 1 root root 132839 2006-10-07 23:10 moduli //ssh服务器的Diffie-Hellman密钥文件
-rw-r--r-- 1 root root 1423 2006-10-07 23:10 ssh_config //ssh客户端配置文件
-rw-r--r-- 1 root root 1874 2006-10-20 17:45 sshd_config //ssh服务器配置文件
-rw------- 1 root root 668 2006-10-20 17:46 ssh_host_dsa_key //ssh服务器dsa算法私钥
-rw-r--r-- 1 root root 602 2006-10-20 17:46 ssh_host_dsa_key.pub //ssh服务器dsa算法公钥
-rw------- 1 root root 1679 2006-10-20 17:46 ssh_host_rsa_key //ssh服务器rsa算法私钥
-rw-r--r-- 1 root root 394 2006-10-20 17:46 ssh_host_rsa_key.pub //ssh服务器rsa算法公钥
tony@tonybox:~$
如果没有特别要求使用默认设置即可满足使用要求.
启动ssh服务
$ sudo /etc/init.d/ssh start
停止ssh服务
$ sudo /etc/init.d/ssh stop
重启ssh服务
$ sudo /etc/init.d/ssh restart
使用ssh首次连接一个远程ssh服务器时,会出现类似下边的信息。这是因为ssh不能识别这台主机,键入yes将会把这台服务器的信息写入 /.ssh/known_hosts文件,下次连入这台远程服务器时就不会出现这类信息。

相关推荐