B*********s 发帖数: 292 | 1 In Ubuntu Server, I can "sudo shutdown -h now" to turn off computer if I am
logged in as a root.
Now I need to do it in a non-root account. I don't want this account to have
root privilege, for security concern. But this account should be able to
turn off computer.
What should I do?
Last year I heard of one function, that root can generate one shell file
using root privilege, and give permission to non-root to run the shell
command with temporary root-privilege. But I forget what that function | e*n 发帖数: 1511 | 2 这个,
在一般的desktop上不都是non-root可以关机么?
am
have
【在 B*********s 的大作中提到】 : In Ubuntu Server, I can "sudo shutdown -h now" to turn off computer if I am : logged in as a root. : Now I need to do it in a non-root account. I don't want this account to have : root privilege, for security concern. But this account should be able to : turn off computer. : What should I do? : Last year I heard of one function, that root can generate one shell file : using root privilege, and give permission to non-root to run the shell : command with temporary root-privilege. But I forget what that function
| Z**0 发帖数: 1119 | 3 可以在sudo里边加允许普通用户shutdown,no password。
自己看sudo.conf | B*********s 发帖数: 292 | 4 Thanks, Zer0. visudo and added one line:
user hostname = NOPASSWD: /sbin/shutdown
now the user(non-root) can sudo shutdown , but can't sudo anything else.
That is exactly what I want. |
|