LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-18-2010, 09:35 PM   #1
Josh000
Member
 
Registered: Aug 2009
Distribution: Slackware 13 64bit
Posts: 534

Rep: Reputation: 35
Shutting down as a normal user


I know this has been asked before, but I just wanted to clarify things.

Is there any way to shutdown as a normal user without changing permissions?


I don't want to press ctrl+alt+del or the power button.

If I add a user to the power group on slackware, will that user have access to shutdown frm the commandline by running /sbin/shutdown -h now?

Or is the power group only used by DE's?

Is the only remaining solution to use sudo, other than manually changing permissions on the shutdown executable?
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 05-18-2010, 09:39 PM   #2
exvor
Senior Member
 
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: Gentoo, LFS, Debian,Ubuntu
Posts: 1,537

Rep: Reputation: 87
Quote:
Originally Posted by Josh000 View Post

Is the only remaining solution to use sudo, other than manually changing permissions on the shutdown executable?
yes.

I am unsure what the power group actually does on slackware so I am at a loss to answer that question but the only way that I am aware of is to allow the user to use sudo to shutdown the machine. You can limit there use of sudo for only this task however instead of giving every user access to everything via sudo, which IMHO I do not understand why distros allow all users access to everything via sudo. Seams like a bad idea from a security standpoint.
 
Old 05-19-2010, 12:00 AM   #3
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
If you are at runlevel 4, kdm will let you shut down/poweroff the machine. You don't have to be root (in fact, you aren't anyone since you aren't logged in).
 
Old 05-19-2010, 12:06 AM   #4
Josh000
Member
 
Registered: Aug 2009
Distribution: Slackware 13 64bit
Posts: 534

Original Poster
Rep: Reputation: 35
Sorry, I should have said I mean from the commandline. I don't use KDE or Gnome or XFCE, and was just after a commandline solution.
 
Old 05-19-2010, 12:43 AM   #5
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Ah.
As root:
Code:
visudo
and add the line "%power ALL = NOPASSWD: /sbin/shutdown"

You'll still have to use the command...
Code:
sudo /sbin/shutdown -h now
...but you won't be asked for a password.

The above line restricts the command to members of the power group.

"man sudoers" tells you more than you'd want to know about the sudoers file.
 
Old 05-19-2010, 03:30 AM   #6
Josh000
Member
 
Registered: Aug 2009
Distribution: Slackware 13 64bit
Posts: 534

Original Poster
Rep: Reputation: 35
I'm more than familiar with sudo, I was just hoping there was a solution that didn't rely on it.
 
Old 05-19-2010, 03:37 AM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

You can use a symlink, as /sbin/halt runs with setuid
Code:
ln -s /sbin/poweroff /usr/bin
Regards
 
Old 05-19-2010, 03:57 AM   #8
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Quote:
Originally Posted by bathory View Post
Hi,

You can use a symlink, as /sbin/halt runs with setuid
Code:
ln -s /sbin/poweroff /usr/bin
Not true in Slackware64 13.0.

Code:
x@x:~$ ls -l /sbin/poweroff 
lrwxrwxrwx 1 root root 4 2009-09-26 10:43 /sbin/poweroff -> halt*
x@x:~$ ls -l /sbin/halt     
-rwxr-xr-x 1 root root 12424 2008-09-25 12:31 /sbin/halt*
The man page for halt specifically mentions:
Quote:
If you're not the superuser, you will get the message `must be superuser'.
 
Old 05-19-2010, 07:36 AM   #9
tommcd
Senior Member
 
Registered: Jun 2006
Location: Philadelphia PA USA
Distribution: Lubuntu, Slackware
Posts: 2,230

Rep: Reputation: 293Reputation: 293Reputation: 293
In case anyone using XFCE is wondering about this, adding a user to the power group in Slackware will allow regular users to shutdown the computer from the desktop in XFCE. I forget why exactly this does not work in KDE.
 
Old 05-19-2010, 10:15 AM   #10
Fidori
LQ Newbie
 
Registered: Oct 2007
Location: Finland
Distribution: Slackware
Posts: 27

Rep: Reputation: 17
If you are a member of the power group, you can shutdown from the command line with:
Code:
dbus-send --system --print-reply --dest="org.freedesktop.Hal" /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Shutdown
 
2 members found this post helpful.
Old 05-19-2010, 10:59 AM   #11
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Excellent!
 
Old 05-19-2010, 11:01 AM   #12
samac
Senior Member
 
Registered: Mar 2004
Location: Kirkwall, Orkney
Distribution: Linux Mint 20.3 - Cinnamon
Posts: 1,425

Rep: Reputation: 139Reputation: 139
Or you can just press the off switch on your computer it is set to shut down gracefully.

samac
 
Old 05-19-2010, 11:04 AM   #13
samac
Senior Member
 
Registered: Mar 2004
Location: Kirkwall, Orkney
Distribution: Linux Mint 20.3 - Cinnamon
Posts: 1,425

Rep: Reputation: 139Reputation: 139
Yep! it works

samac
 
Old 05-19-2010, 10:41 PM   #14
Josh000
Member
 
Registered: Aug 2009
Distribution: Slackware 13 64bit
Posts: 534

Original Poster
Rep: Reputation: 35
Unfortunatly, pressing the power button is not at all a solution.

The dbus command works,,,,it will be kind of a long alias, but if it gets the job done......
 
Old 05-19-2010, 11:18 PM   #15
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Why not just put it in a script?
 
  


Reply



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
How to run daemon process being a normal user [not root user]. narendra1310 Linux - Software 1 10-26-2009 09:48 AM
super user privileges check for a normal user in bash script freeindy Programming 2 08-01-2008 06:08 AM
Giving user 'www-data' same permissions as normal user MikeOfAustin Linux - Software 5 06-08-2007 02:50 AM
Running super user commands as normal user mickyg Linux - Security 5 10-14-2005 07:25 PM
Games runs slow as normal user, but fast as root user mcore Linux - Software 2 06-07-2004 11:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 01:42 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