Page 1 of 3 123 LastLast
Results 1 to 10 of 24

Thread: sudo: (whatever): command not found

  1. #1

    Default sudo: (whatever): command not found

    Any time I try to run a command located in /sbin or /usr/sbin using sudo, like "sudo ifconfig" or "sudo tail -f /var/log/messages", it comes back with "command not found". If I perform a "sudo -i" and drop to a root shell that way, the commands work fine. My sudoers file is as follows:

    Code:
    Defaults always_set_home
    Defaults env_reset
    
    Defaults env_keep = "LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS XDG_SESSION_COOKIE"
    
    # User privilege specification
    root    ALL=(ALL) ALL
    normaluser      ALL=(ALL) ALL
    On my older Debian system my sudoers file looks exactly like this and I have no problems running privileged commands using sudo on that box.

    If I run sudo /usr/bin/env path on both machines, the relevant variables are identical on both machines. Why can't I run privileged shell commands using sudo in 11.1?

  2. #2
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    26,865
    Blog Entries
    15

    Default Re: sudo: (whatever): command not found

    Quote Originally Posted by mightyteegar
    Any time I try to run a command located in /sbin or /usr/sbin using
    sudo, like "sudo ifconfig" or "sudo tail -f /var/log/messages", it comes
    back with "command not found". If I perform a "sudo -i" and drop to a
    root shell that way, the commands work fine. My sudoers file is as
    follows:


    Code:
    --------------------

    Defaults always_set_home
    Defaults env_reset

    Defaults env_keep = "LANG LC_ADDRESS LC_CTYPE LC_COLLATE
    LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME
    LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS
    XDG_SESSION_COOKIE" # User privilege specification root ALL=(ALL) ALL
    normaluser ALL=(ALL) ALL

    --------------------


    On my older Debian system my sudoers file looks exactly like this and I
    have no problems running privileged commands using sudo on that box.

    If I run sudo /usr/bin/env path on both machines, the relevant
    variables are identical on both machines. Why can't I run privileged
    shell commands using sudo in 11.1?
    Hi
    Maybe on the Deb system the user/system profile in /etc adds the /sbin
    and /usr/sbin paths to your environment. Or maybe the files exist
    in /usr/sbin on the Deb system and on openSUSE they are in /sbin?

    I would update your ~/.profile to update your PATH variable.

    --
    Cheers Malcolm (Linux
    Counter #276890) openSUSE 11.1 x86 Kernel 2.6.27.7-9-default
    up 9:03, 2 users, load average: 0.15, 0.09, 0.11
    GPU GeForce 6600 TE/6200 TE - Driver Version: 180.22


  3. #3

    Default Re: sudo: (whatever): command not found

    Doesn't appear to be a PATH issue. On my Deb box, my user PATH is:

    Code:
    /usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/home/normaluser/bin
    and on my SUSE box it is:

    Code:
    /opt/kde3/bin:/home/normaluser/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/NX/bin:/home/normaluser/bin
    /sbin and /usr/sbin aren't found in either of those.

    On my SUSE box, here is what I get if I run sudo env:

    Code:
    PATH=/usr/sbin:/bin:/usr/bin:/sbin
    which means that at least in theory, I should be able to type just command names and not absolute paths and they should run. If I run "sudo /sbin/ifconfig" it works, but that's clumsy. Adding /sbin and /usr/sbin to my path isn't a desired solution because then I can just run any privileged command as user, which defeats the purpose of them being privileged (and means that both sudo and su are now unnecessary for read access; I'd only need them if I wanted to make changes).

    Bug in SUSE's implementation of sudo?

  4. #4
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    26,865
    Blog Entries
    15

    Default Re: sudo: (whatever): command not found

    Quote Originally Posted by mightyteegar
    Doesn't appear to be a PATH issue. On my Deb box, my user PATH is:


    Code:
    --------------------
    /usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/home/normaluser/bin
    --------------------


    and on my SUSE box it is:


    Code:
    --------------------
    /opt/kde3/bin:/home/normaluser/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/NX/bin:/home/normaluser/bin
    --------------------


    /sbin and /usr/sbin aren't found in either of those.

    On my SUSE box, here is what I get if I run sudo env:


    Code:
    --------------------
    PATH=/usr/sbin:/bin:/usr/bin:/sbin
    --------------------


    which means that at least in theory, I should be able to type just
    command names and not absolute paths and they should run. If I run
    "sudo /sbin/ifconfig" it works, but that's clumsy. Adding /sbin and
    /usr/sbin to my path isn't a desired solution because then I can just
    run any privileged command as user, which defeats the purpose of them
    being privileged (and means that both sudo and su are now unnecessary
    for read access; I'd only need them if I wanted to make changes).

    Bug in SUSE's implementation of sudo?
    Hi
    Totally agree with your comments about adding the paths. Can you
    compare the /etc/sudoers files?

    --
    Cheers Malcolm (Linux Counter #276890)
    openSUSE 11.1 x86 Kernel 2.6.27.7-9-default
    up 9:45, 2 users, load average: 0.06, 0.22, 0.32
    GPU GeForce 6600 TE/6200 TE - Driver Version: 180.22


  5. #5

    Default Re: sudo: (whatever): command not found

    They are perfectly identical. I just reinstalled sudo on SUSE and copied my /etc/sudoers file straight from the Debian box to my SUSE box. Still no luck.

    Meh, guess I'll just have to stick with sudo -i for now... oh, how I hate extra typing

  6. #6
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    26,865
    Blog Entries
    15

    Default Re: sudo: (whatever): command not found

    Quote Originally Posted by mightyteegar
    They are perfectly identical. I just reinstalled sudo on SUSE and
    copied my /etc/sudoers file straight from the Debian box to my SUSE box.
    Still no luck.

    Meh, guess I'll just have to stick with sudo -i for now... oh, how I
    hate extra typing
    Hi
    I wonder if the differences are in the /etc/permission* files......

    --
    Cheers Malcolm (Linux Counter #276890)
    openSUSE 11.1 x86 Kernel 2.6.27.7-9-default
    up 10:04, 2 users, load average: 0.17, 0.15, 0.18
    GPU GeForce 6600 TE/6200 TE - Driver Version: 180.22


  7. #7

    Default Re: sudo: (whatever): command not found

    Hm, never seen those before. Debian doesn't use them. I will look into that.

  8. #8
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,160

    Default Re: sudo: (whatever): command not found

    I have no idea what I am talking about , but instead of the line you have:
    Quote Originally Posted by mightyteegar View Post
    Code:
    root    ALL=(ALL) ALL
    I have
    Code:
    root    ALL=(ALL) SETENV: ALL
    Is this of any use?
    Henk van Velden

  9. #9

    Default Re: sudo: (whatever): command not found

    That didn't work. Didn't expect it to -- that just allows root to override environment variable restrictions.

    But I'm curious now -- Henk, does your sudo work like it's supposed to? If so, can you post your sudoers file?

  10. #10
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,160

    Default Re: sudo: (whatever): command not found

    Here it is:
    Code:
    boven:~ # cat /etc/sudoers
    # sudoers file.
    #
    # This file MUST be edited with the 'visudo' command as root.
    #
    # 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
    
    # Prevent environment variables from influencing programs in an
    # unexpected or harmful way (CVE-2005-2959, CVE-2005-4158, CVE-2006-0151)
    Defaults always_set_home
    Defaults env_reset
    
    Defaults env_keep = "LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS XDG_SESSION_COOKIE"
    # Comment out the preceding line and uncomment the following one if you need
    # to use special input methods. This may allow users to compromise  the root
    # account if they are allowed to run commands without authentication.
    #Defaults env_keep = "LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS XDG_SESSION_COOKIE XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER"
    
    # In the default (unconfigured) configuration, sudo asks for the root password.
    # This allows use of an ordinary user account for administration of a freshly
    # installed system. When configuring sudo, delete the two
    # following lines:
    Defaults targetpw   # ask for the password of the target user i.e. root
    ALL ALL=(ALL) ALL   # WARNING! Only use this together with 'Defaults targetpw'!
    
    # Runas alias specification
    
    # User privilege specification
    root    ALL=(ALL) SETENV: ALL
    
    # 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
    boven:~ #
    But I must add that i did say on purpose that I have no idea what I am talking about. I do not use sudo myself. I have "Terminal Program (in system management mode)" in my panel and use that one normaly because mostly I do want to do more then one statement as root.

    But for a test I did:
    Code:
    henk@boven:~> sudo ls /
    Wachtwoord:
    bin   dev  help  lib         media  opt   root  srv  tmp  var
    boot  etc  home  lost+found  mnt    proc  sbin  sys  usr
    henk@boven:~>
    So it seems to work for me.
    Hope this helps.
    Henk van Velden

Page 1 of 3 123 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •