2 May 2013

Disable users login during server Maintenance

In some situations, when performing server maintenance, it is needed to ensure no user can login to avoid data loss or interference.
It can be easily done by
updating PAM configuration.

For instance for SSH (there is lots of other type):
 - check /etc/pam.d/sshd file, and add - if needed - the following line
account    required     pam_nologin.so

 - create the following empty file
touch /etc/nologin

It's done, and it takes effect immediately.
Only root can now login.

When Maintenance is done, do not forget to restore user login by removing the file:
rm /etc/nologin

No comments:

Post a Comment

Thank you for your visit, let's share your point of view: