Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Do you know if it is possible to create a user in linux that can only do "reboot" command without sudo?

the reason is, i need to automate the rebooting of my production server(s) without having to logging into each one, and then has to do "sudo reboot" and putting in the password (which can be time consuming)

share|improve this question
Why exactly do you need to reboot the production server(s) each day? –  Andrew Jun 15 '11 at 23:37

2 Answers 2

This can be done quite simply using /usr/sbin/visudo to add the following lines:

User_Alias REBOOTUSERS = Lee, testuser

After adding those lines the user(s) specified by the User_Alias REBOOTUSERS will be able to enter:

$sudo reboot

And it will reboot the server without a password prompt!

share|improve this answer
For extra safety, you should not edit /etc/sudoers directly, but rather use /usr/sbin/visudo. This performs file locking and some sanity checks to make sure the config is valid before saving. –  Alex Jun 15 '11 at 23:32

Just use the NOPASSWD option in your sudoers config for that user/command.

share|improve this answer
For security reasons I would make sure that this userid cannot be used to ssh into your servers. This will add a layer of protection. Also, I would disable the password (NOTE: not blank password), which will make it impossible to login with this account, only su to it, or run commands. –  slashdot Jun 16 '11 at 0:25
Look into ssh public key authentication. Then you can disable the passwords for said users and still be able to ssh in. –  ptman Jun 16 '11 at 3:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.