从官方网站下载openssh编译升级后,登录发现ulimit不生效。
这是因为默认的sshd_config配置是不使用pam的,需要在编译时加上--with-pam选项。另外观察sshd_config是不是已经设置了UsePAM yes;
以及/etc/pam.d/sshd中是否设置登录规则,如果没有可以加入:
echo "#%PAM-1.0" >> /etc/pam.d/sshd
echo "auth include password-auth" >> /etc/pam.d/sshd
echo "account include password-auth" >> /etc/pam.d/sshd
echo "password include password-auth" >> /etc/pam.d/sshd
echo "session include password-auth" >> /etc/pam.d/sshd