vsftpd user disables ssh login

  • 2020-12-20 03:58:11
  • OfStack

preface

vsftp is a convenient and secure ftp server software. Can use the system user login, can also use virtual user login, login. If a system user logs in, by default, that user logs in to the system. This means you can log in to the ftp server, or you can log in to the system. This is sometimes unsafe because you log into the system and see a lot of files.

Create a system account and simply log that account into ftp

1: Add /bin/false to file /etc/bash


cat /etc/shells
/bin/sh
/bin/bash
/usr/bin/sh
/usr/bin/bash
/bin/false

Section 2: Specify user (zhangsan) using /bin/false


usermod -s /bin/false zhangsan

After a two-step setup, you can only use the ftp server and disable login.

note

There are differences between /bin/false and /sbin/nologin. The common part is that users cannot log in to the system. The way may be different. When I tried /bin/fase under centos7, I logged out without prompting. When I configured ftp, I used /sbin/nologin to achieve the desired effect, but now I need to use /bin/false.

Probable cause

If it can be implemented with /sbin/nologin before, and the system users can only log in ftp, then my environment is not available now, indicating that this is related to the system Settings and the configuration of vsftp.

conclusion


Related articles: