There are times when you may need to prevent users from logging into the system. Here is a way of doing that.
# cat > /etc/nologin
The system is currently unavailable to all users. Try back in two hours.
Ctrl+d
Here is the message you will get when you try to login as a user. As you can see, it echoes the contents of the /etc/nologin file.
# login
login: esofthub
Password:
The system is currently unavailable to all users. Try back in two hours.
This blog covers Unix system administration HOWTO tips for using inline for loops, find command, Unix scripting, configuration, SQL, various Unix-based tools, and command line interface syntax. The Unix OS supports tasks such as running hardware, device drivers, peripherals and third party applications. Share tips/comments. Read the comments. But most importantly: Read Disclaimer - Read Disclaimer.
Subscribe to:
Post Comments (Atom)
4 comments:
and then how do you reenable logins?
Delete or mv (rename) the nologin file with the super user account, root. The nologin file has no effect on it.
I doubt that "cat" understands the ":wq" ... seems more like vi :-)
Maybe you meant something like cat > /etc/nologin <<EOF (heredoc stuff ?)
stephane, I'm chuckling over here in Korea. I can't believe I did that. It was a late night post, and I didn't proof the post. I'll make the correction. Thanks for keeping me straight. Roy
Post a Comment