Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop context.
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 am using Ubuntu Mate. Can I setup my system to only allow one user (me) to shutdown or restart the system? I want to ensure the system will never be taken down allowing for certain scripts to run overnight.
You should have that by default. Ubuntu gives the first registered user full sudo rights, but no other user has those rights unless the first user gives them by editing /etc/sudoers. However, if other people have physical access to the computer, there's nothing to stop someone from simply switching it off at the mains.
You should have that by default. Ubuntu gives the first registered user full sudo rights, but no other user has those rights unless the first user gives them by editing /etc/sudoers. However, if other people have physical access to the computer, there's nothing to stop someone from simply switching it off at the mains.
Thanks for the reply! I double checked if anyone can restart or shutdown the system and they could. What would I need to edit in the /etc/sudoers to fix this?
What other users do you have? Who created them? Do they all belong to some "users" group that has rights? It's ages since I used any of the *buntus. You used to have to use sudo with a shutdown command, but that may have changed.
What would I need to edit in the /etc/sudoers to fix this?
Are they all in the group "sudo" ? That's the only group set by default. If so, then just remove them from that group. If they are not, then you'll have to look if there is another group with similar permissions. Otherwise, you'll have to spend a few days and look at polkit permissions.
My desktop knowledge is a bit limited but the desktop shutdown button is controlled by polkit and not sudoers. You need to create a rule to only allow the desired user. I found a couple of examples.
Distribution: VM Host: Slackware-current, VM Guests: Artix, Venom, antiX, Gentoo, FreeBSD, OpenBSD, OpenIndiana
Posts: 1,006
Rep:
I did use sudo.
you can create something like shutdown group that have permission to shutdown/restart system
or
you can give individual user the right to shutdown/reboot system
for example run visudo and enter:
user_name ALL=NOPASSWD:/sbin/poweroff
user_name ALL=NOPASSWD:/sbin/reboot
the above means that specified user can poweroff/reboot machine without providing password. You can of course give user rights to poweroff machine with password required. I assume though that you trust yourself so no password needed...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.