LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Want To Try Slack - Afraid Of One Thing..... (https://www.linuxquestions.org/questions/slackware-14/want-to-try-slack-afraid-of-one-thing-4175501883/)

wigry 05-09-2014 02:12 PM

About powering off the computer, look here:

http://www.linuxquestions.org/questi...3/#post3418902

There are also other groups that your regular user should be part of to be able to do "normal" things like plugging in the USB mass storage, mound CD-s etc:

http://docs.slackware.com/slackbook:users
http://alien.slackbook.org/dokuwiki/...lackware:fixes

Sumguy 05-09-2014 02:44 PM

Quote:

Originally Posted by sycamorex (Post 5167942)
.... It's the same with Windows or any other OS. Windows does not come with it either.

Very true! I was actually thinking that when I wrote my last reply. Only thing is, with Windows, you expect to be in a helpless daze! :D

ReaperX7 05-09-2014 02:53 PM

Adding your primary user account to the "wheel" group should give you enough permissions to do reboot and shutdown sequences.

Sumguy 05-09-2014 03:03 PM

Quote:

Originally Posted by wigry (Post 5167944)
About powering off the computer, look here:

http://www.linuxquestions.org/questi...3/#post3418902

There are also other groups that your regular user should be part of to be able to do "normal" things like plugging in the USB mass storage, mound CD-s etc:

http://docs.slackware.com/slackbook:users
http://alien.slackbook.org/dokuwiki/...lackware:fixes

Funny thing is: I had already added my user account to "power" [and I just checked it again, to make sure...) and I had set-up sudo....and still...no matter what shutdown command I type (shutdown; shutdown -h now; poweroff; halt; etc.) when in my user account, I get "command not found"- even when I use sudo.

Do these things only happen to me? :)

Sumguy 05-09-2014 03:04 PM

Quote:

Originally Posted by ReaperX7 (Post 5167969)
Adding your primary user account to the "wheel" group should give you enough permissions to do reboot and shutdown sequences.

Did that too- last week.

And I could even see if I were getting the message "only root can do that"- but I get "command not found"...until I log in as root. Is that weird or what???

Loomx 05-09-2014 03:05 PM

Quote:

Hey guys, how come in Slackware, I have to switch to root in order to poweroff? (sudo, which I enabled for my regular user account, doesn't even work for that)
Make sure you use full paths to the commands; you can also add the NOPASSWD option. E.g. In my 'sudoers' file I have this line so I can run "sudo /usr/sbin/pm-suspend" (via the 'sleep' key):
Code:

myuser ALL=NOPASSWD: /usr/sbin/pm-suspend
For shutdown, just push the power button once :) I have yet to find a computer that doesn't shutdown cleanly if you do that.
The only thing more powerful than root access is physical access..

Sumguy 05-09-2014 05:04 PM

Quote:

Originally Posted by Loomx (Post 5167990)
Make sure you use full paths to the commands; you can also add the NOPASSWD option. E.g. In my 'sudoers' file I have this line so I can run "sudo /usr/sbin/pm-suspend" (via the 'sleep' key):
Code:

myuser ALL=NOPASSWD: /usr/sbin/pm-suspend

No password sounds a little risky, even for me! (And I'm the guy who ran Windows for 9 years without updating or using AV...) (Never had a problem)

Quote:

Originally Posted by Loomx (Post 5167990)
For shutdown, just push the power button once :) I have yet to find a computer that doesn't shutdown cleanly if you do that.
The only thing more powerful than root access is physical access..

Hehe, I don't know why...but it pains me to do that. (Back when I first started with Linux, I must have spent an hour once, trying to figure out how to get out of console mode without hitting the power button...but finally had to.)

I suspect, like most of my computer habits and taboos, it's probably something ingrained from my Windows daze/days.

jtsn 05-09-2014 06:09 PM

Quote:

Originally Posted by Sumguy (Post 5167909)
Hey guys, how come in Slackware, I have to switch to root in order to poweroff?

That is the traditional Unix multi-user philosophy. Only the superuser can shut down and reboot the machine, because that affects other users, so a regular user cannot do that.

Still there is a RedHat/Fedora/freedesktop.org way to do this as a user (from the guys who brought you systemd). On Slackware 13.37 and earlier you do
Code:

dbus-send --system --print-reply --dest=org.freedesktop.Hal /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Shutdown
dbus-send --system --print-reply --dest=org.freedesktop.Hal /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Restart

and on 14.0 and above it is
Code:

ck-launch-session; dbus-send -–system –-print-reply -–dest=org.freedesktop.ConsoleKit /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop
ck-launch-session; dbus-send -–system –-print-reply -–dest=org.freedesktop.ConsoleKit /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart

Of course, the command will change every 18 months, as the people designing these interfaces have no stability in mind. ;)

Sumguy 05-09-2014 07:14 PM

Thanks, JTSN,

Well...at least I know it's normal then- and not that I've configured something wrong. I feel better now!

Seems easier just to switch to root, than to do all that other stuff- but sheesh! Ya'd think that they wouldn't make it so hard just to turn something off! (As you say though, I can see why- maybe like someone has a server running- and an employee is doing maintenance, and the owner doesn't want him to be able to just turn it off one day if the guy is mad or something, eh?)

Darn! If you can't count on Slackware for stability, what can ya count on?!

Continuing my Slack adventures: I just LSed into /sbin.... Wow, there's a ton of cool stuff in there! I even know what some of it is for! (Can you tell? I'm coming along nicely. 2 weeks ago, I would have started X and opened a file browser to look in /sbin...noiw I LSed from the console! Woo-hoo!)

_____

Re: Shutting down:

O-K.....just tried "sudo /sbin/poweroff" (a la Loomx) and it worked! (/sbin/shutdown" returned an error saying that it must include a time argument, and to try "now"- but for some reason, even with "now" I'd get the same message!)

If I use the XFCE desktop, I can shutdown through there via the GUI thingy.....

Seems like a lot of trouble just to turn the darn computer off! (But I'll get used to it)

______

Yet ANOTHER question:

I noticed that some of the same files in /sbin are also in /bin- only the /sbin versions seem to be symbolic links, while the /bin versions seem to be executable (?)- could anyone briefly explain what the purpose of that is? (I tried out a few of the interesting-sounding things in those directories....and I will Google some, to find out what they are!)

And...why is it that you have to type the full path to use some...and yet others can be run just by typing their name? Sheesh! The more I think I'm beginning to get a handle on this stuff...the more it seems I don't know!

sycamorex 05-09-2014 07:44 PM

Quote:

Originally Posted by Sumguy (Post 5168113)
Yet ANOTHER question:

I noticed that some of the same files in /sbin are also in /bin- only the /sbin versions seem to be symbolic links, while the /bin versions seem to be executable (?)- could anyone briefly explain what the purpose of that is? (I tried out a few of the interesting-sounding things in those directories....and I will Google some, to find out what they are!)

And...why is it that you have to type the full path to use some...and yet others can be run just by typing their name? Sheesh! The more I think I'm beginning to get a handle on this stuff...the more it seems I don't know!

Hope that explains it:
http://linuxtroubleshoot.blogspot.co...s-sbin-vs.html

Symbolic links are used for efficiency. There is no need to store the same file in 2 places.

If you need type the full path as a standard user (and you're running a login shell), it means that the command is not in your path, which, in turn, means that probably it's not meant to be run as that particular user. For example, a lot of administrative commands are inaccessible to standard users as they are mean to be run as root.

jtsn 05-09-2014 07:47 PM

Quote:

Originally Posted by Sumguy (Post 5168113)
If I use the XFCE desktop, I can shutdown through there via the GUI thingy.....

The GUI thingy does ConsoleKit D-Bus "messaging", too. The crap is just hidden behind a fancy click button there.

BTW: You don't have to type stuff like that every time, you just learn how to script things and how to use shell aliases.

Loomx 05-09-2014 08:03 PM

Quote:

Code:

myuser ALL=NOPASSWD: /usr/sbin/pm-suspend
No password sounds a little risky, even for me! (And I'm the guy who ran Windows for 9 years without updating or using AV...) (Never had a problem)
Note that this `/etc/sudoers' line only allows that specific command without asking for a password, so hopefully not too much of a security hole.. :)
The `ALL' means you can run it from any host.

TracyTiger 05-09-2014 09:04 PM

Quote:

Originally Posted by Sumguy (Post 5168113)
(/sbin/shutdown" returned an error saying that it must include a time argument, and to try "now"- but for some reason, even with "now" I'd get the same message!)

Code:

shutdown -h now
See man shutdown.

TracyTiger 05-09-2014 09:11 PM

Quote:

Originally Posted by Sumguy (Post 5168113)
And...why is it that you have to type the full path to use some...and yet others can be run just by typing their name? Sheesh!

As a normal user print the PATH variable with
Code:

echo $PATH
Then login as root print the PATH variable using the same command.

Note the difference? /sbin is in the execution path for root but not a normal user.

EDIT: Experiment with the commands as a regular user and as root. Try becoming root with the command "su" and as "su -" (hyphen).
which <program>
whereis <program>
type <program>
alias

You want to learn more about the commands above and tried the man pages but nothing was found? Try the type command (type type).

Sumguy 05-12-2014 09:52 AM

Hmmmm..... Since installing Slack on my newly-acquired used laptop, I haven't been having any problems with LILO. Wonder iffin' the previous problems could have had something to do with my 'puter?

Quote:

Originally Posted by jtsn (Post 5168134)
BTW: You don't have to type stuff like that every time, you just learn how to script things and how to use shell aliases.

Oooo! That opens up a whole new world of possibilities, doesn't it?! It's been on agenda to learn some scripting. I think I can start soon, now that I seem to have using the terminal figured out.


All times are GMT -5. The time now is 03:56 AM.