LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 10-05-2017, 11:06 AM   #1
mikedelo
Member
 
Registered: Mar 2004
Location: Staten Island, NY
Distribution: MX Linux
Posts: 63

Rep: Reputation: 0
User Permission to shutdown or restart


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.
 
Old 10-05-2017, 01:23 PM   #2
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,563
Blog Entries: 19

Rep: Reputation: 4445Reputation: 4445Reputation: 4445Reputation: 4445Reputation: 4445Reputation: 4445Reputation: 4445Reputation: 4445Reputation: 4445Reputation: 4445Reputation: 4445
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.
 
Old 10-06-2017, 09:00 AM   #3
mikedelo
Member
 
Registered: Mar 2004
Location: Staten Island, NY
Distribution: MX Linux
Posts: 63

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by hazel View Post
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?
 
Old 10-06-2017, 11:11 AM   #4
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,563
Blog Entries: 19

Rep: Reputation: 4445Reputation: 4445Reputation: 4445Reputation: 4445Reputation: 4445Reputation: 4445Reputation: 4445Reputation: 4445Reputation: 4445Reputation: 4445Reputation: 4445
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.
 
Old 10-06-2017, 11:59 AM   #5
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,292
Blog Entries: 3

Rep: Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718
Quote:
Originally Posted by mikedelo View Post
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.
 
Old 10-06-2017, 02:47 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,675

Rep: Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892
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.

https://www.centos.org/forums/viewtopic.php?t=51963
https://superuser.com/questions/3546...tdowns-or-rebo
 
1 members found this post helpful.
Old 10-21-2017, 09:50 PM   #7
Aeterna
Senior Member
 
Registered: Aug 2017
Location: Terra Mater
Distribution: VM Host: Slackware-current, VM Guests: Artix, Venom, antiX, Gentoo, FreeBSD, OpenBSD, OpenIndiana
Posts: 1,006

Rep: Reputation: Disabled
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...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
my user account can't restart, shutdown or suspend newbiesforever Linux - General 12 06-03-2014 11:07 AM
Can't shutdown/restart as normal user in Lenny jman82s Linux - Software 8 05-20-2009 08:53 PM
how to disable shutdown/restart for a user in GNOME ramesh14 Linux - Newbie 1 05-06-2008 05:48 AM
Solaris 10 - Allow any user to shutdown or restart Red Barchetta Solaris / OpenSolaris 1 05-12-2007 02:29 AM
Normal User Restart and Shutdown InsaneBob Linux - Software 2 08-23-2003 05:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 05:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration