LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 05-06-2014, 12:38 PM   #1
Pinonoir
Member
 
Registered: May 2014
Posts: 209

Rep: Reputation: 0
Slackware unable to shutdown or reboot user account "command not found".


First off, this is my first post in the forums. Secondly, I am new to slackware.
I'm unable to shutdown my regular user account, I have added myself to the wheel and power groups and edited the sudoers file in Vi as it says. Also, Visudo seems to not work for the regular user as well. Any help would be much appreciated

Last edited by Pinonoir; 05-08-2014 at 02:08 PM.
 
Old 05-06-2014, 01:06 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
visudo is used to edit the sudoers file which is used to grant superuser (root) authority to run other commands. Due to this regular users should NOT be able to run the command - only the root user.

"shutdown" and "reboot" deal with stopping or stopping/restarting the entire OS so there is no such thing as shutting down or rebooting a user. User's simple "exit" or "logoff".

You'd have to post the values from your sudoers file (the one visudo edits) for anyone to tell you more about it. However, "command not found" generally means that either the command (file) does not exist OR (more often) that the user trying to run it does not have the directory it lives in within their PATH variable and have not given the fully qualified path name of the file.

e.g.
cp is a command in /bin on many systems. The fully qualified path to cp is "/bin/cp". One could always type "/bin/cp" when using the command and it should work because it always knows where it is due to being told where it is. However, it is more usual to simply type "cp" and let it search your PATH variable to find it.
If you type "echo $PATH" you'll see what directories (separated by colons) are searched to find commands.

When you are the root user you usually have a different PATH than regular users because the admin commands are used by root but not by regular users. "shutdown" and "reboot" commands are admin commands usually in /sbin.
 
Old 05-06-2014, 01:27 PM   #3
Pinonoir
Member
 
Registered: May 2014
Posts: 209

Original Poster
Rep: Reputation: 0
GNU nano 2.3.2 File: /etc/sudoers

## 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
##
## Groups of machines. These may include host names (optionally with wildcards),
## IP addresses, network numbers or netgroups.
# Host_Alias WEBSERVERS = www1, www2, www3

##
## User alias specification
##
## Groups of users. These may consist of user names, uids, Unix groups,
## or netgroups.
# User_Alias ADMINS = millert, dowdy, mikef

##
## Cmnd alias specification
##
## Groups of commands. Often used to group related commands together.
# Cmnd_Alias PROCESSES = /usr/bin/nice, /bin/kill, /usr/bin/renice, \
# /usr/bin/pkill, /usr/bin/top

##
## Defaults specification
##
## You may wish to keep some of the following environment variables
## when running commands via sudo.
##
## Locale settings
# Defaults env_keep += "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET"
##
## Run X applications through sudo; HOME is used to find the
## .Xauthority file. Note that other programs use HOME to find
## configuration files and this may lead to privilege escalation!
# Defaults env_keep += "HOME"
##
## X11 resource path settings
# Defaults env_keep += "XAPPLRESDIR XFILESEARCHPATH XUSERFILESEARCHPATH"
##
## Desktop path settings
# Defaults env_keep += "QTDIR KDEDIR"
##
## Allow sudo-run commands to inherit the callers' ConsoleKit session
# Defaults env_keep += "XDG_SESSION_COOKIE"
##
## Uncomment to enable special input methods. Care should be taken as
## this may allow users to subvert the command being run via sudo.
# Defaults env_keep += "XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER"
##
## Uncomment to enable logging of a command's output, except for
## sudoreplay and reboot. Use sudoreplay to play back logged sessions.
# Defaults log_output
# Defaults!/usr/bin/sudoreplay !log_output
# Defaults!/usr/local/bin/sudoreplay !log_output
# Defaults!/sbin/reboot !log_output

##
## Runas alias specification
##

##
## User privilege specification
##
root ALL=(ALL) ALL
pino ALL=(ALL) ALL
## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL) ALL
%pino ALL=(ALL) ALL
## Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL

## Uncomment to allow members of group sudo to execute any command
# %sudo ALL=(ALL) ALL

## Uncomment to allow any user to run sudo if they know the password
## of the user they are running the command as (root by default).
# Defaults targetpw # Ask for the password of the target user
# ALL ALL=(ALL) ALL # WARNING: only use this together with 'Defaults targetpw'

## Read drop-in files from /etc/sudoers.d
## (the '#' here does not indicate a comment)
#includedir /etc/sudoers.d
 
Old 05-06-2014, 01:37 PM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
If you've got the ALL = ALL specification then you should be able to run any command but you'd have to preface it with "sudo"

e.g. to run "visudo" as any user with such a specification you'd have to run "sudo visudo" and input that user's password when prompted.

At that point the PATH becomes important as previously disucssed. Running commands with root privilege via sudo is NOT the same as running them with root's environment (including PATH).
 
Old 05-06-2014, 01:41 PM   #5
mrclisdue
Senior Member
 
Registered: Dec 2005
Distribution: Slackware
Posts: 1,134

Rep: Reputation: 277Reputation: 277Reputation: 277
See this post for a "workaround" to your issue specific to Slackware (and runlevel 3, shutting down/rebooting from a cli, etc.)

https://www.linuxquestions.org/quest...ml#post3695769

iirc, it ultimately has to do with consolekit/policykit etc.

Tho the post is a bit dated, I *believe* it still applies.

*EDIT* -- just tried my own advice and it no longer works, apologies. There is a post by rworkman in the same thread that appears relevant to editing sudoers, etc.

cheers,

Last edited by mrclisdue; 05-06-2014 at 01:52 PM.
 
Old 05-06-2014, 01:44 PM   #6
Pinonoir
Member
 
Registered: May 2014
Posts: 209

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by MensaWater View Post
If you've got the ALL = ALL specification then you should be able to run any command but you'd have to preface it with "sudo"

e.g. to run "visudo" as any user with such a specification you'd have to run "sudo visudo"
Still showing command not found, at least I know it has to do with a path. How would I create a new path or edit it in /etc/profile as /.bash_profile and bashrc don't exist.
 
Old 05-06-2014, 02:14 PM   #7
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
The specification for PATH in /etc/profile (or .profile or .bashrc or .bash_profile) is:

PATH=directory1:directory2:directory3:directory4...

where the items are directories that contain executables e.g.:

PATH=/bin:/usr/bin:/sbin:/opt:/usr/local/bin:/usr/share/bin

Note that order they are defined in is the order they'll be searched and it will stop when it finds the command. So with the above sample PATH if /usr/bin/sqlexec existed and also /usr/local/bin/sqlexec existed and you typed just "sqlexec" without specifying which one it would use the one in /usr/bin because it found that first.

You can add to the PATH simply by adding ":newdir" to the end of the existing PATH or by adding a new line below it that appends it to the existing variable such as:
PATH=$PATH:newdir

Sometimes you do the latter because it isn't clear what all is going into the PATH based on other files being sourced during the login.

In above "newdir" would be the directory you wish to add such as ":/sbin".

Typically there should also be a location where it does "export" of "PATH" (often along with other variables) to make the defined PATH available.
 
Old 05-06-2014, 02:58 PM   #8
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,345

Rep: Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588
sudo isn't set up by default in Slackware. use su to become as root.
 
Old 05-06-2014, 05:30 PM   #9
Pinonoir
Member
 
Registered: May 2014
Posts: 209

Original Poster
Rep: Reputation: 0
Here's what I edited.

# Set the default system $PATH:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/local/sbin:/usr/sbin:/sbin"
 
Old 05-06-2014, 05:56 PM   #10
Drakeo
Senior Member
 
Registered: Jan 2008
Location: Urbana IL
Distribution: Slackware, Slacko,
Posts: 3,716
Blog Entries: 3

Rep: Reputation: 483Reputation: 483Reputation: 483Reputation: 483Reputation: 483
Quote:
Slackware unable to shutdown or reboot user account "command not found".
make sure that user is in power group. and then it will work through the policy-kit. on all the desktop environments.
from command line assume root then type reboot or shutdown -h now
keep it simple.
 
Old 05-06-2014, 06:03 PM   #11
Pinonoir
Member
 
Registered: May 2014
Posts: 209

Original Poster
Rep: Reputation: 0
I've already added myself to the power group, still showing command not found for the user.
 
Old 05-06-2014, 07:37 PM   #12
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,345

Rep: Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588
Are you starting X with startx from command line, or is slackware booting straight into X?
 
Old 05-06-2014, 07:50 PM   #13
Pinonoir
Member
 
Registered: May 2014
Posts: 209

Original Poster
Rep: Reputation: 0
Solved, it seems after changing the default path I didn't reboot for the changes to take effect.
 
  


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
unable to login user account "orasp" on linux server premkumar.st Linux - Newbie 1 03-28-2012 12:28 PM
[FYI] "last -f <old wtmp> -x reboot shutdown" incorrect for last reboot and shutdown catkin Linux - General 1 03-25-2010 11:52 PM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
"shutdown" and "halt" symlinks: poweroff, reboot. sud_crow Linux From Scratch 11 10-17-2006 11:03 PM
Removing "shutdown" and "reboot" in logout window nearfar Red Hat 1 10-07-2003 11:33 AM

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

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