免费注册 查看新帖 |

Chinaunix

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

sshd_config中的DenyUsers选项不起作用,急! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-02-03 16:16 |只看该作者 |倒序浏览
我在/etc/ssh/sshd_config中添加
DenyUsers 8888
然后后启ssh,可8888用户还是能用ssh登录.这是为什么?
系统为SLES 9

论坛徽章:
0
2 [报告]
发表于 2009-02-03 16:44 |只看该作者
原帖由 yry6649324 于 2009-2-3 16:16 发表
我在/etc/ssh/sshd_config中添加
DenyUsers 8888
然后后启ssh,可8888用户还是能用ssh登录.这是为什么?
系统为SLES 9

DenyUsers username

这个语法是正确的

论坛徽章:
0
3 [报告]
发表于 2009-02-03 17:00 |只看该作者
重启sshd服务了吗?

论坛徽章:
0
4 [报告]
发表于 2009-02-03 17:06 |只看该作者
重启sshd之后,8888是不能通过ssh连接到linux,但是可以本地登录。

论坛徽章:
0
5 [报告]
发表于 2009-02-04 00:23 |只看该作者
现在的问题就是重启了ssh后,8888还是能通过ssh远程连到linux上.
sshd_config文件只有一个,而且更改了permitrootlogin yes,再重启ssh,证明sshd用的就是这个配置文件.
今天搞了一天也找不到原因.

论坛徽章:
0
6 [报告]
发表于 2009-02-04 00:24 |只看该作者
用sshd -t也测试过了,配置文件没有错误.

论坛徽章:
0
7 [报告]
发表于 2009-02-04 04:43 |只看该作者
你所建立的用户名是特殊用户名,你看一下8888用户的UID就知道了,很多配置文件是认UID的
建议不要建立纯数字用户名

论坛徽章:
0
8 [报告]
发表于 2009-02-04 08:45 |只看该作者
谢谢scofield凌晨4点钟还回贴.
声明一下,8888只是随便乱输的,只是表示是一个用户.再加上SUSE上不允许用纯数字来做用户名.
而且sshd_config的man page里说必须要用用户名,不能用用户ID.以下是sshd_config的全部配置:

#Port 22
#Protocol 2,1
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 768

# Logging
#obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6

#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFile     .ssh/authorized_keys

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# Set this to 'yes' to enable support for the deprecated 'gssapi' authentication
# mechanism to OpenSSH 3.8p1. The newer 'gssapi-with-mic' mechanism is included
# in this release. The use of 'gssapi' is deprecated due to the presence of
# potential man-in-the-middle attacks, which 'gssapi-with-mic' is not susceptible to.
#GSSAPIEnableMITMAttack no


# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication mechanism.
# Depending on your PAM configuration, this may bypass the setting of
# PasswordAuthentication, PermitEmptyPasswords, and
# "PermitRootLogin without-password". If you just want the PAM account and
# session checks to run without PAM authentication, then enable this but set
# ChallengeResponseAuthentication=no
UsePAM yes

#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression yes
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
DenyUsers s8888

# no default banner path
#Banner /some/path

# override default of no subsystems
Subsystem       sftp    /usr/lib/ssh/sftp-server

# This enables accepting locale enviroment variables LC_* LANG, see sshd_config(5).
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL

论坛徽章:
0
9 [报告]
发表于 2009-02-04 08:48 |只看该作者
有没有可能是pam的问题?

论坛徽章:
0
10 [报告]
发表于 2009-02-04 09:24 |只看该作者
DenyUsers s8888

试试
DenyUser s8888

有的版本是不要s
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP