• 2007-09-24

    sshd 配置 - [网络相关]

    版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
    http://lnote.blogbus.com/logs/10003892.html

    “/etc/ssh/sshd_config”是OpenSSH的配置文件,允许设置选项改变这个daemon的运行。这个文件的每一行包含“关键词-值”的匹配,其中“关键词”是忽略大小写的。下面列出来的是最重要的关键词,用man命令查看帮助页(sshd (8))可以得到详细的列表。

    # This is ssh server systemwide configuration file.
    Port 22
    ListenAddress 192.168.1.1
    HostKey /etc/ssh/ssh_host_key
    ServerKeyBits 1024
    LoginGraceTime 600
    KeyRegenerationInterval 3600
    PermitRootLogin no
    IgnoreRhosts yes
    IgnoreUserKnownHosts yes
    StrictModes yes
    X11Forwarding no
    PrintMotd yes
    SyslogFacility AUTH
    LogLevel INFO
    RhostsAuthentication no
    RhostsRSAAuthentication no
    RSAAuthentication yes
    PasswordAuthentication yes
    PermitEmptyPasswords no
    AllowUsers admin

    下面逐行说明上面的选项设置:

    Port 22
    “Port”设置sshd监听的端口号。

    ListenAddress 192.168.1.1
    “ListenAddress”设置sshd服务器绑定的IP地址。

    HostKey /etc/ssh/ssh_host_key
    “HostKey”设置包含计算机私人密匙的文件。

    ServerKeyBits 1024
    “ServerKeyBits”定义服务器密匙的位数。

    LoginGraceTime 600
    “LoginGraceTime”设置如果用户不能成功登录,在切断连接之前服务器需要等待的时间(以秒为单位)。

    KeyRegenerationInterval 3600
    “KeyRegenerationInterval”设置在多少秒之后自动重新生成服务器的密匙(如果使用密匙)。重新生成密匙是为了防止用盗用的密匙解密被截获的信息。

    PermitRootLogin no
    “PermitRootLogin”设置root能不能用ssh登录。这个选项一定不要设成“yes”。

    IgnoreRhosts yes
    “IgnoreRhosts”设置验证的时候是否使用“rhosts”和“shosts”文件。

    IgnoreUserKnownHosts yes
    “IgnoreUserKnownHosts”设置ssh daemon是否在进行RhostsRSAAuthentication安全验证的时候忽略用户的“$HOME/.ssh/known_hosts”

    StrictModes yes
    “StrictModes”设置ssh在接收登录请求之前是否检查用户家目录和rhosts文件的权限和所有权。这通常是必要的,因为新手经常会把自己的目录和文件设成任何人都有写权限。

    X11Forwarding no
    “X11Forwarding”设置是否允许X11转发。

    PrintMotd yes
    “PrintMotd”设置sshd是否在用户登录的时候显示“/etc/motd”中的信息。

    SyslogFacility AUTH

    “SyslogFacility”设置在记录来自sshd的消息的时候,是否给出“facility code”。

    LogLevel INFO
    “LogLevel”设置记录sshd日志消息的层次。INFO是一个好的选择。查看sshd的man帮助页,已获取更多的信息。

    RhostsAuthentication no
    “RhostsAuthentication”设置只用rhosts或“/etc/hosts.equiv”进行安全验证是否已经足够了。

    RhostsRSAAuthentication no
    “RhostsRSA”设置是否允许用rhosts或“/etc/hosts.equiv”加上RSA进行安全验证。

    RSAAuthentication yes
    “RSAAuthentication”设置是否允许只有RSA安全验证。

    PasswordAuthentication yes
    “PasswordAuthentication”设置是否允许口令验证。

    PermitEmptyPasswords no
    “PermitEmptyPasswords”设置是否允许用口令为空的帐号登录。

    AllowUsers admin
    “AllowUsers”的后面可以跟着任意的数量的用户名的匹配串(patterns)或user@host这样的匹配串,这些字符串用空格隔开。主机名可以是DNS名或IP地址。

    ------------------------------------------------------------- 

    如果出现  ssh_exchange_identification

    编辑  hosts.deny  把 ALL: ALL: DENY 注释掉

    --------------------------------------------------------------

     由SecureCRT 生成的密钥对和用OpenSSH生成的密钥对在格式上不一样,而且二者都只能认识自己的密钥的格式,所以在用SecureCRT同OpenSSH连接时分别都要用它们自己的密钥格式,可以用任何一个方法生成然后使用ssh-keygen -i 把SecureCRT生成的的密钥转换成OpenSSH的密钥格式,或者用ssh-keygen -e把OpenSSH的密钥格式转换成SecureCRT能够识别的IETF SECSH格式。

     


    收藏到:Del.icio.us




    评论

  • 我用的是 winsshd 在windows下面建服务器
  • 博主您好,见到你的文章,可想而知是位高人.我想用sshd组建一个tunnel通道来突破防火墙,就像http-tunnel一样.但我不会设置,客户端用什么.您能不能教我?越具体越好,麻烦发到我的邮箱好吗?谢谢!