我正在configurationvsftpd以便从networking上的设备上传。 传统原因需要FTP。 不pipe我想怎么样,这都是我无法改变的。 所以,请不要build议我不要使用ftp! 该接口被烧入到我必须连接的设备的固件中,并且不能改变或控制。
我的问题:我想尽可能防止shell访问(或任何其他types的访问,除了传输文件)。
我正在configuration/usr/sbin/nologin的shell。 为了防御深度(例如为了减轻对shell的意外变化),我对你可能有的任何其他想法感兴趣。
例如,我正在考虑创build一个.ssh目录到帐户的主目录,拥有root:root模式0550,设置不可变的位。 这将防止设备的帐户能够为自己configurationSSH访问。
有没有更好的方法来防止通过vsftpd上传SSH密钥? 为了安全起见,是否还有其他文件或目录会被“禁止”上传?
我会后退一步,完全禁用SSH /那些帐户。
在你的sshd_config ,你可以列出哪些用户可以通过SSHlogin,或者你可以列出哪些用户是不允许的。 相关的关键字是
AllowGroups This keyword can be followed by a list of group name patterns, separated by spaces. If specified, login is allowed only for users whose primary group or supplementary group list matches one of the patterns. AllowUsers This keyword can be followed by a list of user name patterns, separated by spaces. If specified, login is allowed only for user names that match one of the patterns.
和他们的同行DenyUsers和DenyGroups 。
您还可以通过更改ssh授权密钥文件的名称来进一步混淆问题,以便即使有人将文件上载到.ssh/authorized_keys ,SSH也不会使用该文件。 相关的关键字是
AuthorizedKeysFile Specifies the file that contains the public keys that can be used for user authentication.
或者你可以select拒绝SSH密钥authentication,虽然我通常不会build议。
你也可以使用vsftpd的deny_file选项限制ftpd中的file upload,我build议你看看你的pamconfiguration,以阻止用户通过SSH以外的其他方法login。