To disable shell and FTP access for a user account on a Linux system, you can use the usermod
command.
To disable shell access for a user called user1
, you can use the following command:
usermod -s /sbin/nologin user1
This will change the user's shell to /sbin/nologin
, which will prevent the user from logging in to the system via the shell.
To disable FTP access for the user, you can use the chmod
command to remove the execute permission for the user's home directory:
chmod -x /home/user1
This will prevent the user from accessing the directory via FTP.
Note that disabling shell and FTP access for a user account will also prevent the user from using other programs that require shell or FTP access, such as scp
or rsync
.