最近装了个Ubuntu服 务器,需要创建专用的ftp用户,为了安全要禁止ftp用户登录shell。

按照在freebsd的操作习惯,我把ftp用户的shell设定为/usr /bin/nologin。岂料该用户居然无法登录ftp,把shell改成/bin/bash后,ftp又能登录了。难道不能禁止登录。网上一遍,解决 方法居然很多,包括禁止22端口、设置/etc/hosts.deny或者/etc/hosts.allow等。

然而这些方法都有不少局限性,最后发现原 因是/usr/bin/nologin不在/etc/shells列表内,ftp登录时要检查该用户的shell设定是否正确,我把shell强行改成不 存在的/usr/bin/nologin,结果就出错了。

  解决方法:修改/etc/shells,在shell列表中添加一行/usr/bin/nologin。把ftp用户的shell改为/usr/bin/nologin。

Leave a Reply

电子邮件地址不会被公开。 必填项已用*标注

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="">

请选择吧!