LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   sudo slackpkg = command not found (http://www.linuxquestions.org/questions/slackware-14/sudo-slackpkg-%3D-command-not-found-792446/)

gabrielmagno 03-01-2010 05:36 PM

sudo slackpkg = command not found
 
I edited my "sudoers" file with "visudo".
Added the line, after the root privileges definition.

Code:

root    ALL=(ALL) ALL
myuser  ALL=(ALL) ALL

I try to:
Code:

$ sudo ls /root
Blah  Blahblah  file.txt

Ok.

But then I try to:
Code:

$ sudo slackpkg
sudo: slackpkg: command not found

With direct root acces it's ok:
Code:

$ sudo su
# slackpkg
....
....
executes normally
....
....

What may be wrong?

koenigdavidmj 03-01-2010 05:38 PM

You should have /sbin and /usr/sbin in your normal user path if you want to use sudo. Otherwise a lot of packaging utilities will break.

hedron 03-01-2010 05:39 PM

Try typing the full path to slackpkg? e.g.: sudo /sbin/slackpkg

gabrielmagno 03-01-2010 06:30 PM

$ sudo /usr/sbin/slackpkg
works

What is the most simple way to permanently add "/usr/sbin" to the $PATH variable?

mRgOBLIN 03-01-2010 06:48 PM

add PATH="$PATH:/usr/sbin" to one of your startup files

~/.profile or ~/.bash_login perhaps

dive 03-01-2010 11:17 PM

Why don't you just login with 'su -' ? That will give you a proper root login shell with paths etc.

info.latawaz 06-21-2013 01:09 AM

I didn't know that sudo needs to be installed. But I followed the link and did what was asked. Finally got this message.

Quote:

root@localhost:~# slackpkg install sudo

Looking for sudo in package list. Please wait... DONE

No packages match the pattern for install. Try:

/usr/sbin/slackpkg reinstall|upgrade
After this, I added path /sbin to $PATH with this
Quote:

export PATH=$PATH:/sbin
echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib64/kde4/libexec:/usr/lib64/qt/bin:/usr/share/texmf/bin:.:/sbin
So it seems PATH /sbin has been added. Before that I had added below line to /etc/sudoer
Quote:

myuser localhost=/sbin/halt;/sbin/poweroff;/sbin/shutdown
After this, as myuser, I am doing this
Quote:

sudo poweroff
Password:
Sorry, user myuser is not allowed to execute '/sbin/poweroff' as root on localhost.
What am I missing?

NonNonBa 06-21-2013 02:47 AM

Hi,

I think you need commas as command separator, not semi-colons. :)

info.latawaz 06-21-2013 03:01 AM

Oops! Sorry Gabriel. I didn't realize that I was posting this in your thread. Sorry for that. I stumbled upon your thread because I think we two are trying to do the same thing. Hope my post comes in handy.

Thanks NonNonBa, will do what you are suggesting.

info.latawaz 06-22-2013 02:23 AM

Have a look at this post.
http://www.linuxquestions.org/questi...776/page2.html
Should help.

Conrad_Troutman 06-22-2013 05:41 AM

I had the same problem. I fixed it by adding the following line to sudoers:

Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"


All times are GMT -5. The time now is 10:20 AM.