Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want one of my users (let's call him: pn) to be able to start X by sudo init 5.
I don't want to give him access to any other commands.


I read man sudoers, but I don't understand too much of it.

Can anyone provide a quick line to add to /etc/sudoers file that would do the trick?
I would be grateful eternally.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Run sudo visudo and add the following line to the end of /etc/sudoers:

pn [hostname] = (root) NOPASSWD: /sbin/init 5

Replace [hostname] with the output of hostname.

After this change, the user pn will be able to execute sudo init 5 without a password.

share|improve this answer
    
It worked, thanks. –  Vlad K. Dec 5 '12 at 21:53
add comment

Your Answer

 
discard

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.