You are not logged in.

#1 2008-01-14 04:01:26

mivison
Member
Registered: 2007-09-09
Posts: 29

How do i shutdown my computer as a user? (solved!)

i am running fluxbox without a logon manager. i have it starting X at boot.  i wood like to shutdown or reboot without using su. is there a script i can use or config file i can change?

Last edited by mivison (2008-01-16 23:46:41)

Offline

#2 2008-01-14 04:10:04

jacko
Member
Registered: 2007-11-23
Posts: 840

Re: How do i shutdown my computer as a user? (solved!)

this question was just asked the other day. if I knew the thread I would point u to it, but that's why we have search feature.

I will see what I can find...

http://bbs.archlinux.org/viewtopic.php?id=41913&p=1 its in that thread, if I told u it was on the second page I'd be giving u to much of a hint!

Last edited by jacko (2008-01-14 04:12:58)

Offline

#3 2008-01-14 04:13:23

mivison
Member
Registered: 2007-09-09
Posts: 29

Re: How do i shutdown my computer as a user? (solved!)

thank you
i will look too

Offline

#4 2008-01-14 04:18:18

Gustavo
Member
From: Brazil
Registered: 2006-07-04
Posts: 92

Re: How do i shutdown my computer as a user? (solved!)

Well, I use su and an alias, but without having to type a password. Just edit /etc/pam.d/su to make su trust users in the wheel group. After that you can add an alias to your ~/.bashrc:

alias off="su -c 'shutdown -h now'"

Same can be done with sudo, just type visudo as root, edit the file and add an alias to your bashrc:

alias off="sudo shutdown -h now"

Offline

#5 2008-01-14 10:51:54

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: How do i shutdown my computer as a user? (solved!)

For the sudo route, run visudo and add the user in as follows:

username ALL=(ALL) NOPASSWD:/sbin/halt,/sbin/reboot

Last edited by T-Dawg (2008-01-14 10:52:32)

Offline

#6 2008-01-14 13:31:47

Kane
Member
Registered: 2006-10-08
Posts: 220

Re: How do i shutdown my computer as a user? (solved!)

doesnt adding the user to the power group work?

it works for me but im using xfce

Offline

#7 2008-01-14 14:06:03

byte
Member
From: Düsseldorf (DE)
Registered: 2006-05-01
Posts: 2,046

Re: How do i shutdown my computer as a user? (solved!)

The power group is only used by hal/dbus. Normal reboot/halt/poweroff/shutdown makes no use of it.


1000

Offline

#8 2008-01-14 15:18:25

mezoko
Member
Registered: 2005-03-26
Posts: 310
Website

Re: How do i shutdown my computer as a user? (solved!)

If you have a button no your case or laptop you could setup acpi so it poweroff when you hit the button, that how I have my laptop setup. You could also change ctrl+alt+del to shutdown in terminal.


"The only thing we have to fear is fear itself." - Franklin D. Roosevelt

Offline

#9 2008-01-16 16:54:40

mivison
Member
Registered: 2007-09-09
Posts: 29

Re: How do i shutdown my computer as a user? (solved!)

i tried using sudo, but it still asks for a password. also no matter what password i give it rejects  it.

here is sudoers file:

# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
# Failure to use 'visudo' may result in syntax or file permission errors
# that prevent sudo from running.
#
# See the sudoers man page for the details on how to write a sudoers file.
#

# Host alias specification

# User alias specification

# Cmnd alias specification

# Defaults specification

# Runas alias specification

# User privilege specification
root    ALL=(ALL) ALL
%users  ALL=NOPASSWD: /sbin/reboot
%users  ALL=NOPASSWD: /sbin/halt
# Uncomment to allow people in group wheel to run all commands
# and set environment variables.
#%wheel ALL=(ALL) SETENV: ALL

# Same thing without a password
#%wheel ALL=(ALL) NOPASSWD: SETENV: ALL

# Samples
# %users  ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
# %users  localhost=/sbin/shutdown -h now,/sbin/halt,/sbin/reboot
#%users  ALL=/sbin/reboot
sudoers (END)

what am i doing wrong?

Last edited by mivison (2008-01-16 16:57:43)

Offline

#10 2008-01-16 18:05:31

Gustavo
Member
From: Brazil
Registered: 2006-07-04
Posts: 92

Re: How do i shutdown my computer as a user? (solved!)

Make sure your user is a member of the users group.

Offline

#11 2008-01-16 18:26:11

canistra
Member
Registered: 2007-11-03
Posts: 66

Re: How do i shutdown my computer as a user? (solved!)

i think the most easy way will be to do a chmod +s halt

Offline

#12 2008-01-16 23:42:08

mivison
Member
Registered: 2007-09-09
Posts: 29

Re: How do i shutdown my computer as a user? (solved!)

thanks every one!
solved
Gustavo was correct. my group name was wrong i changed "users" in these 2 lines to my group name.
%users  ALL=NOPASSWD: /sbin/reboot
%users  ALL=NOPASSWD: /sbin/halt

i thought "%users" meant all users other than root. i am new to linux and sometimes the "HOW TO" web sites get confusing.

Offline

Board footer

Powered by FluxBB