论坛: UNIX系统 标题: sshd笔记 复制本贴地址    
作者: ooo [teczm]    版主   登录
1.开启sshd服务(inetd方式,尽量不要用此方式)
编辑/etc/inetd.conf,确保下行前没有#号:
ssh  stream  tcp  nowait  root  /usr/sbin/sshd  sshd -i -4

1.开启sshd服务(rc.conf方式,尽量用此方式)
编辑/etc/rc.conf,确保下行存在
sshd_enable="YES"


2.记录ssh登录log
编辑/etc/syslog.conf,将下行:
security.*    /var/log/security 改为:
security.*;auth.info  /var/log/security
实现:ssh登录的用户登录记录在/var/log/security中,
内容:
Feb 16 10:44:54 teczm kernel: ipfw: 200 Accept UDP 192.168.7.3:137 192.168.7.1:1
Feb 16 10:46:19 teczm kernel: ipfw: 200 Accept TCP 192.168.7.3:1086 192.168.7.1:1

#建议将/etc/syslog.conf权限设为600

3.ssh配置:
ssh全局配置文件/etc/ssh/ssh_config
ssh用户配置文件$HOME/.ssh/config

默认设置如下:
# Host *
#  ForwardAgent no
#  ForwardX11 no
#  RhostsAuthentication no
#  RhostsRSAAuthentication no
#  RSAAuthentication yes
#  PasswordAuthentication yes
#  HostbasedAuthentication no
#  BatchMode no
#  CheckHostIP no
#  StrictHostKeyChecking ask
#  IdentityFile ~/.ssh/identity
#  IdentityFile ~/.ssh/id_rsa
#  IdentityFile ~/.ssh/id_dsa
#  Port 22                #使用22端口
#  Protocol 2,1          #使用SSH protocol 2和1
#  Cipher 3des
#  Ciphers aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes2
#  EscapeChar ~
#  VersionAddendum FreeBSD-20030924

问题1:将/etc/ssh/sshd_config误删除后,客户端不能ssh上去,
解决办法:
#cat /etc/ssh/ssh_config > sshd_config
#chmod 744 sshd_config
#reboot
成功!

ps:猪头说:touch sshd_config就行了。
  http://www.20cn.net/cgi-bin/club/show.pl?key=GECogjLplEKZ&cat=security&forum=unix&page=1&position=1986&id=1108544927  

问题2:5.3下无法SSH登陆服务器
引用:
Unable to authenticate using any of the configured authentication methods

需要编辑/etc/ssh/sshd_config
确保下行存在
引用:
PasswordAuthentication yes



[此贴被 ooo(teczm) 在 03月08日08时48分 编辑过]

地主 发表时间: 05-03-08 08:17

回复: ooo [teczm]   版主   登录
ps:清空/var/log/security
#cat /dev/null > /var/log/security

B1层 发表时间: 05-03-08 08:20

论坛: UNIX系统

20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon

粤ICP备05087286号