Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have two linux boxes (Red Hat 9.0 and Squid 2.5.STABLE1) running as proxys at 2 cyber cafes. Sometimes it is needed to reboot or shutdown the servers, and it is hard for someone that has little computer knowledge to login and reboot / shutdown the system manually.
I would like to create a menu instead of the server login or maybe create a user that logs into that menu instead of the regular prompt, so that anyone can reboot or shutdown the server if needed. I used to use them with DOS, but as i 'm new to the LINUX world i don't know where to start.
Anyone knows how can I create the menu, or where can i find infomation about that ?
Great ! , thats what im talking about =). Now, where do i place the code so that the user logs into the script, and can do nothing else but shut down, reboot, o log out.
I think we are going to find is that the users are not allowed to run the shutdown command. You may have to set up the sudoers file and change the script commands to use the sudo command also.
Do you know how to set that up?
The other choice would be to leave the script as is, and set the suid bit on the /sbin/shutdown and reboot commands.
chmod 4755 /sbin/shutdown then any user can run the command.
It is quite possible that you do not need to restart the entire machine. Can't the squid daemon or whatever simply be restarted rather than the entire machine?
edit the file /etc/sudoers by typing visudo at the command line as root
in that file make an entry for the user I will call him joe
joe ALL=(ALL) NOPASSWD: /sbin/shutdown, /sbin/reboot
then save the file
Change the menu you have and at the place where it says /sbin/shutdown insert the word sudo
"1") sudo /sbin/shutdown now -i0 ;;
"2") sudo /sbin/reboot ;;
The sudo command allows another user to run whatever apps root designates as long as he types the word sudo in front of the command. By default he is prompted for his password. (His not roots) but with the line in the sudoers file that says NOPASSWD: he will not have to put in his password.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.