1 Answer
This can be done by two ways. Either by using usermod with nologin option or --lock option.
To restrict login using nologin, run the below command.
# usermod -s /sbin/nologin [USERNAME]
To restrict using --lock option,
# usermod --lock [USERNAME]
Your Answer
x