Restrict/unrestrict user login in linux system
- To restrict user login:
sudo usermod -s /usr/sbin/nologin username
- Check if the user has been restricted:
sudo su - username
It will show a message similar to the following:
This account is currently not available.
- To unrestrict user login:
sudo usermod -s /bin/bash username