Linux系统中OpenSSH的安装配置6
为本地服务器创建私有和公用密匙,执行下面的命令:
[root@deep]# su username
[username@deep]$ ssh-keygen1
举个例子,显示出来的结果可能是:
Initializing random number generator...
Generating p: ............................++ (distance 430)
Generating q: ......................++ (distance 456)
Computing the keys...
Testing the keys...
Key generation complete.
Enter file in which to save the key (/home/username/.ssh/identity): 【按下回车键】
Enter passphrase:
Enter the same passphrase again:
Your identification has been saved in /home/username/.ssh/identity.
Your public key is:
1024 37
14937757511251955533691120318477293862290049394715136511145806108870001764378494676831
29757784315853227236120610062314604405364871843677484233240919418480988907860997175244
46977589647127757030728779973708569993017043141563536333068888944038178461608592483844
590202154102756903055846534063365635584899765402181 username@deep.openarch.com
Your public key has been saved in /home/username/.ssh/identity.pub
注意:如果有多个帐号需要为每个帐号创建一个密匙。
你可能要为下面的服务器创建密匙:
Mail服务器
Web服务器
网关服务器
这允许对这些服务器进行有限的访问,例如,不允许用Mail服务器的帐号访问Web服务器或网关服务器。这样可以增加整体的安全性,即使因为某种原因有一个密匙被泄密了,也不会影响到其它的服务器。
第二步
把本机的公用密匙(identity.pub)拷贝到远程主机的“/home/username/.ssh”目录下,例如,使用“authorized_keys”这个名字。
注意:拷贝文件的一个方法使用ftp命令,另一个办法是把公用密匙用email(包含“~/.ssh/identity.pub”文件的内容)发给系统管理员。
改变pass-phrase
用加上“-p”参数的“ssh-keygen”命令,在任何时候都可以改变pass-phrase。用下面的命令,改变pass-phrase:
[root@deep]# su username
[username@deep]$ ssh-keygen1 –p
Enter file key is in (/home/username/.ssh/identity): [按下回车键]
Enter old passphrase:
Key has comment username@deep.openarch.com
Enter new passphrase:
Enter the same passphrase again:
Your identification has been saved with the new passphrase.
OpenSSH用户工具
下面列出的是一些我们经常要用到的命令,当然还有很多其它的命令,更详细的信息可以查看man帮助页或其它文档。
ssh
ssh(Secure Shell)是用来登录远程计算机和在远程计算机上执行命令的程序。它是用来替代rlogin和rsh,以及在不安全的网络环境下在两台计算机之间提供安全和加密的信息交流。X11连接和TCP/IP端口可以被转发到一个安全的通道里。
http://netadmin.77169.com/HTML/20040623000500.html