SlackwareThis Forum is for the discussion of Slackware Linux.
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.
You'd have to sudo it if you aren't su. It requires kernel permission levels that users simply don't have.
That said, I just push the power button on my computer. On both my laptop and my desktop, the kernel intercepts that button push and shuts down properly. I have no reason to suspect that it wouldn't work for you, either.
The best way to give the users power like that would be to give them permissions to execute shutdown using sudo.
Use visudo to edit the rules file, you should put a line like:
Code:
youruser yourmachinename= NOPASSWD: /sbin/shutdown -h now
or
Code:
%users yourmachinename= NOPASSWD: /sbin/shutdown -h now
to give all the users in users group access to it.
The the users would use: sudo /sbin/shutdown -h now
killerbob, unfortunatly, not all the machines behave like that :/
Visudo is actually vi, so you've to learn how to use vi.
Basically when you enter your are in "read-mode".
Try moving with the arrows, if you can't, use h,j,k,l to move the cursor.
Place at the character you want to remove (the #) and press x to delete the character.
If you need to input some text, press the i key, type what you want and go back to read mode using ESC key.
To save press
Code:
:wq
:w will write the file, :q will quit, and if you need to quit without saving, use, :q!
Edit: Here's a quick intro manual, http://www.macdevcenter.com/pub/a/ma.../vi_intro.html
If you want to go deeper be sure to have installed vim. Copy the file /usr/share/vim/vim63/vimrc_example.vim to ~/.vimrc
and run the program, vimtutor
Originally posted by Nylex Thanks! Edit: God I hate vi .
Heh. If you really hate it that much then just change the symlink in /usr/bin/vi from elvis to something like pico. Then when you visudo you won't need an aspirin.
Nice one, thanks. Quick question though: why is it that you have to use visudo to edit the sudoers file, instead of being able to edit the file directly, like you can with fstab for example?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.