- 论坛徽章:
- 0
|
本帖最后由 zxh1336 于 2011-03-23 15:16 编辑
我最近在实际工作中碰到了一个很奇怪的问题,
需求是这样的:在服务器上配置用户loguser,只允许这个用户通过ssh的公钥认证登录服务器,除次之外其他任何的方式都不允许登录,
于是相关配置如下:
$more /etc/shadow
loguser:!!:14838:0:99999:7:::
$ sudo more /etc/ssh/sshd_config
Protocol 2,1
ServerKeyBits 768
SyslogFacility AUTHPRIV
PermitRootLogin no
#AllowUsers bkops scaleout loguser hadoop
RSAAuthentication yes
PubkeyAuthentication yes
RhostsRSAAuthentication no
HostbasedAuthentication no
IgnoreRhosts yes
PasswordAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no
GSSAPIAuthentication no
UsePAM yes
X11Forwarding no
X11DisplayOffset 10
TCPKeepAlive yes
ClientAliveInterval 15
ClientAliveCountMax 3
Subsystem sftp /usr/libexec/openssh/sftp-server
ListenAddress 0.0.0.0
AllowTcpForwarding yes
在以上配置的情况下,用户loguser可以正常通过公钥认证ssh登录进服务器,和所预想的完全一样。
但是如果我修改sshd的配置为 UsePAM no ,loguser则没法通过ssh访问服务器,并且sshd的日志输出如下
sshd[29723]: User loguser not allowed because account is locked
sshd[29724]: input_userauth_request: invalid user loguser
谁能给我解释一下这个现象? |
|