个人工具

Quick HOWTO : Ch17 : Secure Remote Logins and File Copying/zh

来自Ubuntu中文

Ninesun讨论 | 贡献2008年5月1日 (四) 22:49的版本 SSH加密简介

跳转至: 导航, 搜索


介绍

OpenSSH是最流行的文件传输和远程登录Linux应用程序之一,它提供了多种在客户端和服务器之间建立加密的远程终端和文件传输连接的方式。 OpenSSH Secure Copy (SCP) 和 Secure FTP (SFTP) 程序是FTP的安全替代品, 同时Secure Shell (SSH) 常常被用作是TELNET的一个默认替代程序。OpenSSH 并不局限于Linux系统; SSH 和 SCP 客户端可以运行在包括windows在内的绝大多数操作系统上。

SSH加密简介

数据加密通过使用特殊的数学算法来实现,这种算法把数据流中的数据分解以便使其对任何没有相应解密算法的人不可读。The process is usually made even harder through the use of an encryption key that is used to modify the way the equations do the scrambling. 只有当你拥有解密密码和相应的解密程序的时候你才能得到恢复原始数据。数据加密帮助人们阻止未授权的用户得到这些数据。

SSH通过产生随机私有和公有密钥来实现加密过程。这些密钥通常只会生成一次,但是你还可以重置密钥,尽管这样会降低安全度。

如果要成功的传送加密数据,接收端首先必须拥有一份发送端的公共密钥拷贝。 以下是使用SSH进行数据传输的具体过程。

当你登陆到一个SSH服务器的时候,你将会被提醒在继续下一步之前是否下载服务器的公共密钥。同时你计算机上的SSH客户端密钥也将被上传到服务器。 这样一来,位于SSH连接端的每一台电脑都可以得到其他电脑的密钥,也就意味着这些电脑能够打开其他SSH连接端和“ 通道”发送的加密数据。

Linux中的SSH客户端用户接受到的所有公共密钥和提供这些的密钥的IP地址都存储在一个叫~/.ssh/known_hosts的文件中。当一个密钥和它相对应的IP地址不再匹配时,SSH就判断为出现了错误。 例如,当重新安装操作系统或是升级了SSH应用程序后,可能会重置这些密钥,从而使密钥和IP不匹配。当然,一些骇客行为也可以造成密钥的变更。 为了确保变更的安全性,你从服务器上获得的公有和私有密钥都存储在/etc/ssh/directory文件夹中。

Note: The .ssh directory is a hidden directory, as are all files and directories whose names begin with a period. The ls -a command lists all normal and hidden files in a directory. The ~/ notation is a universally accepted way of referring to your home directory and is recognized by all Linux commands.

Linux uses other key files also to provide the capability of password-less logins and file copying to remote servers using SSH and SCP. In this case, the SSH connection is established, then the client automatically sends its public key which the server uses to match against a predefined list in the user's directory. If there is a match then the login is authorized. These files are also stored in your ~/.ssh directory and need to be specially generated. The id_dsa and id_dsa.pub files are your private and public keys respectively, and authorized_keys stores all the authorized public keys from remote hosts that may log into your account without the need for passwords (more on this later).