免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1012 | 回复: 0
打印 上一主题 下一主题

配置Debian下的SSH [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-10-14 20:07 |只看该作者 |倒序浏览

配置Debian下的SSH
Debian 503版本中实现的,Debian默认好像是没有ssh支持的。
SSH的安装
apt-get install openssh-server
apt-get install ssh
SSH的配置
OpenSSH的配置都集中在/etc/ssh/ssh_config文件中
  编辑“ssh_config”文件(vim /etc/ssh/ssh_config),添加或改变下面的参数: 
  
  # Site-wide defaults for various options 
  Host * 
  ForwardAgent no 
  ForwardX11 no 
  RhostsAuthentication no 
  RhostsRSAAuthentication no 
  RSAAuthentication yes 
  PasswordAuthentication yes 
  FallBackToRsh no 
  UseRsh no 
  BatchMode no 
  CheckHostIP yes 
  StrictHostKeyChecking no 
  IdentityFile ~/.ssh/identity 
  Port 22 
  Cipher blowfish 
  EscapeChar ~ 
  
  下面逐行说明上面的选项设置: 
  
  Host * 
  选项“Host”只对能够匹配后面字串的计算机有效。“*”表示所有的计算机。 
  
  ForwardAgent no 
  “ForwardAgent”设置连接是否经过验证代理(如果存在)转发给远程计算机。 
  
  ForwardX11 no 
  “ForwardX11”设置X11连接是否被自动重定向到安全的通道和显示集(DISPLAY set)。 
  
  RhostsAuthentication no 
  “RhostsAuthentication”设置是否使用基于rhosts的安全验证。 
  
  RhostsRSAAuthentication no 
  “RhostsRSAAuthentication”设置是否使用用RSA算法的基于rhosts的安全验证。 
  
  RSAAuthentication yes 
  “RSAAuthentication”设置是否使用RSA算法进行安全验证。 
  
  PasswordAuthentication yes 
  “PasswordAuthentication”设置是否使用口令验证。 
  
  FallBackToRsh no 
  “FallBackToRsh”设置如果用ssh连接出现错误是否自动使用rsh。 
  
  UseRsh no 
  “UseRsh”设置是否在这台计算机上使用“rlogin/rsh”。 
  
  BatchMode no 
  “BatchMode”如果设为“yes”,passphrase/password(交互式输入口令)的提示将被禁止。当不能交互式输入口令的时候,这个选项对脚本文件和批处理任务十分有用。 
  
  CheckHostIP yes 
  “CheckHostIP”设置ssh是否查看连接到服务器的主机的IP地址以防止DNS欺骗。建议设置为“yes”。 
  
  StrictHostKeyChecking no 
  “StrictHostKeyChecking”如果设置成“yes”,ssh就不会自动把计算机的密匙加入“$HOME/.ssh/known_hosts”文件,并且一旦计算机的密匙发生了变化,就拒绝连接。 
SSH
#服务器端配置 /etc/ssh/sshd_config
#只考虑协议版本2
#全局配置
VersionAddendum TecZm-20050505 #在telnet ip 22时只能看出openssh的版本,看不出OS
Protocol 2 #使用协议版本2
Port 22 #sshd监听22端口
ListenAddress 192.168.7.1 #sshd只监听目标ip为192.168.7.1的请求
AllowGroups wheel myguest #允许wheel组和myguest组的用户登录
AllowUsers teczm authen@192.168.8.5
#允许来自以上组的teczm用户和authen用户登录,
#且authen用户只能从主机192.168.8.5登录
#DenyGroups #拒绝登录的组,参数设置和AllowGroups一样
#DenyUsers #拒绝登录的用户,参数设置和AllowUsers一样
#AllowTcpForwarding yes #是否转发的TCP包都被允许。默认是 “yes”。
LoginGraceTime 60 #60秒内客户端不能登录即登录超时,sshd切断连接。
KeyRegenerationInterval 1800 #1800秒(30分钟)后自动重新生成服务器的密匙。
MaxStartups 3 #设置同时发生的未验证的并发量,即同时可以有几个
UseDNS no #不使用DNS查询客户端。
PermitRootLogin no #不允许root登录,root可由wheel组用户登录后su。
X11Forwarding no #禁止用户运行远程主机上的X程序,我没有X,所以无所谓。
UseLogin yes #禁止X11Forwarding
#认证配置(口令认证、PAM认证、非对称密钥认证任选其一)
#口令认证
PubkeyAuthentication no #不使用非对称密钥认证
PasswordAuthentication yes #使用口令认证
PermitEmptyPasswords no #不允许使用空密码的用户登录
#PAM认证
PasswordAuthentication no #不使用口令认证
UsePAM #使用pam认证
ChallengeResponseAuthentication yes #允许挑战应答方式
#非对称密钥认证
PasswordAuthentication no #不使用口令认证
PubkeyAuthentication yes #使用非对称密钥认证
AuthorizedKeysFile .ssh/authorized_keys #用户认证使用的公钥。
               
               
               
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/59015/showart_2070466.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP