You can create
/etc/nologin to restrict users from login into the system. Only root login will be allowed then.
--- Adding -------
Hi @jeffersonmvg,
Perhaps I didn't read your question properly & I thought you want to restrict users from login into system.
Anyway, you can use
/sbin/nologin shell to restrict user, but check whether this is available in your system or not.
If it's not available, then you can add
/bin/false as shell for the user whom you do not wish to give login access.
Code:
usermod -s /sbin/nologin username
OR
usermod -s /bin/false username
In addition to
/bin/false, add
/dev/null in place of home directory in
/etc/passwd. (Note: Take backup of /etc/passwd if you manually edit it). New /etc/passwd file entry for that user will look like this:
Code:
username:x:123:123:Sample:/dev/null:/bin/false