SUPPORT THE SITE WITH A CLICK

Subscribe Rss:

SUPPORT THE SITE WITH A CLICK

Wednesday, May 7, 2008

Locking out non-root users while the system is in maintenance

To disable all user logins (except for root) without taking down the system into maintenance mode create a file in the location /etc/nologin.
The content of this file will be displayed when a user tries to log in. Useful when doing service on the system which might affect users.

Steps to do:
1.Go to terminal login as sudo user inorder to create file in /etc.
lostwarrior@leo:~$

lostwarrior@leo:~$ sudo -s
[sudo] password for lostwarrior:
root@leo:~#

2.Once u login as root in terminal type cd /etc

3.type touch nologin
Now the user cant able to enter into the machine.If he enters the username then the content from nologin file will get displayed.for example i have written "This system has been locked for maintenance.Anormal service will resume at 2300 hours."
Then it will display the contents in the file

4.NoteBefore doing this try to have the root password.Otherwise u cant enter into the root access.

For creating root password.

1.Go to terminal login as sudo user

warrior@leo:~$
lostwarrior@leo:~$ sudo -s
[sudo] password for lostwarrior:
root@leo:~#
2.now type passwd root (herepasswd is the command and root is the user)

3.enter the new password for root.

root@leo:/etc# passwd root
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@leo:/etc#
NoteThis has been tested under ubuntu 7.10

No comments :

Post a Comment