Quote:
Originally Posted by lgp171188
I want to create an unprivileged user account, say 'shutdown', which can be used only to shutdown the system. I followed the instructions in http://www.cyberciti.biz/tips/shutdo...ux-server.html. But when I login into the system, I get this error 'Cannot execute /usr/bin/sudo /sbin/shutdown -h now: No such file or directory'.
These are the configurations that I did
/etc/sudoers:
Code:
shutdown localhost=/sbin/shutdown -h now
/etc/passwd:
Code:
shutdown:x:999:0:shutdown:/sbin/:/usr/bin/sudo /sbin/shutdown -h now
I guess the shutdown binary and/or the /sbin folder is out of access for the shutdown user. How am I to get it right?
Thanks in advance.
|
Last field should be command, not command with args
So you can use
/etc/passwd:
Code:
shutdown:x:999:0:shutdown:/sbin/:/sbin/my_shutdown
And create in the /sbin shell script my shutdown
Code:
#!/bin/sh
/usr/bin/sudo /sbin/shutdown -h now
And by the way, why do you want shutdown user unprivileged ?
Anyway this user do nothing but shutdown system, so I think you can
make shutdownn user with uid 0 and don't use sudo