Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: sudo: <command> command not found

  1. #1

    Default sudo: <command> command not found

    I would like to use sudo instead of su or su -, as twice this week I've forgotten to logout of root.

    However, sudo returns
    Code:
    sudo: <command>: command not found
    if <command> is in /sbin or /usr/sbin (eg init). This post seems to fix this:
    Quote Originally Posted by mightyteegar
    Set an alias in my .zshrc as follows:

    alias sudo="PATH=$PATH:/sbin:/usr/sbin sudo"

    Hacky, but it works. Thanks to everyone who contributed!
    but I must confess I don't know what a .zshrc file is or where I find it (it's not in ~/ and google sheds no light). What are the security/safety implications of making this change?



    Joban

  2. #2
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,185
    Blog Entries
    1

    Default Re: sudo: <command> command not found

    Simple question. Do you have the sudo RPM installed?

  3. #3

    Default Re: sudo: <command> command not found

    Yes I do, sudo zypper is running right now in fact

  4. #4
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,185
    Blog Entries
    1

    Default Re: sudo: <command> command not found

    Sorry, misunderstood your first post.

  5. #5
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: sudo: <command> command not found

    That post was for zsh. For bash, the corresponding file is ~/.bashrc.

    You could also use sudo -i, which gives you root's environment, and hence PATH.

  6. #6

    Default Re: sudo: <command> command not found

    Thank you!
    I added
    Code:
    alias sudo="PATH=$PATH:/sbin:/usr/sbin sudo"
    to ~/.bashrc and now sudo works for everything!

    Thanks for your help

  7. #7
    Join Date
    Jun 2008
    Location
    Berlin
    Posts
    2,061

    Default Re: sudo: <command> command not found

    I would like to use sudo instead of su or su -, as twice this week I've forgotten to logout of root.
    May I suggest another solution? A timeout for root-shells should do the trick. Add this to /etc/bash.bashrc.local:

    Code:
    if [ "`id -u`" -eq 0 ]; then
      IDLELOGOUT=300
      echo "
    Automatic logout after five minutes without input or job
    "
      export TMOUT=$IDLELOGOUT
    fi
    [In case you don't have a /etc/bash.bashrc.local yet, just create it.]

    You can configure 'IDLELOGOUT' as you please of course. The timeout will be reset whenever there is a job running or input happening.

    Code:
    kalle@hoppers:~> su -
    Password: 
    
    Automatic logout after five minutes without input or job
    
    hoppers:~ # timed out waiting for input: auto-logout
    kalle@hoppers:~>

  8. #8

    Default Re: sudo: <command> command not found

    hi guyz,

    i'm a newbie here.
    I try to run several commands but I face the problem.

    for example:
    zahian@linux-9h2w:~> $tar -xvzf RT2870_Linux_STA_V2.3.0.0.bz2
    If '-xvzf' is not a typo you can use command-not-found to lookup the package that contains it, like this:
    cnf -xvzf
    zahian@linux-9h2w:~> cnf -xvzf
    -xvzf: command not found

    could anyone please tell me what should I do..

    tq.

  9. #9
    Join Date
    Jun 2008
    Location
    Earth - Denmark
    Posts
    10,730

    Default Re: sudo: <command> command not found

    zahian wrote:
    > for example:
    > zahian@linux-9h2w:~> $tar -xvzf RT2870_Linux_STA_V2.3.0.0.bz2
    > If '-xvzf' is not a typo you can use command-not-found to lookup the
    > package that contains it, like this:
    > cnf -xvzf


    this is crazy, i know...but, is tar installed? what do you get with

    Code:
    which tar

    if the which shows tar in your path, then ?????
    -is it executable?
    -if not, why not?
    -what happens if you use YaST (or zypper) to replace your tar?

    do you have any other problems? i mean, maybe you have an all around
    faulty install, from a disk full of errors (or only one: a bogus tar)
    did you:

    1. get your install image from http://software.opensuse.org/112/en ?
    (if not, then where?)
    2. check the md5sum of the downloaded iso?
    3. burn as slow as you can
    4. do this http://tinyurl.com/yajm2aq before install attempt?

    if you answered "no" (or "don't know") to any of those then see the
    following cites before you start over:
    http://en.opensuse.org/Download_Help
    http://tinyurl.com/yhf65pv
    http://tinyurl.com/ycly3eg


    --
    DenverD (Linux Counter 282315)
    CAVEAT: http://is.gd/bpoMD
    posted via NNTP w/TBird 2.0.0.23 | KDE 3.5.7 | openSUSE 10.3
    2.6.22.19-0.4-default SMP i686
    AMD Athlon 1 GB RAM | GeForce FX 5500 | ASRock K8Upgrade-760GX |
    CMedia 9761 AC'97 Audio

  10. #10

    Default Re: sudo: <command> command not found

    Hello zahian,

    Quote Originally Posted by zahian
    i'm a newbie here.
    I try to run several commands but I face the problem.

    for example:
    zahian@linux-9h2w:~> $tar -xvzf RT2870_Linux_STA_V2.3.0.0.bz2
    If '-xvzf' is not a typo you can use command-not-found to lookup the package that contains it, like this:
    cnf -xvzf
    zahian@linux-9h2w:~> cnf -xvzf
    -xvzf: command not found

    could anyone please tell me what should I do..
    First of all welcome to the community!

    I think you're problem lies in the fact that you run this command:
    Code:
    $tar -xvzf RT2870_Linux_STA_V2.3.0.0.bz2
    But you should have used this command instead:
    Code:
    tar -xvzf RT2870_Linux_STA_V2.3.0.0.bz2
    In the first command the "$" will let bash think you mean a variable like $PATH, $PWD, $HOME etc.
    But the variable $tar is empty so bash will execute the command:
    Code:
    -xvzf RT2870_Linux_STA_V2.3.0.0.bz2
    And -xczf isn't a command as far is I know.

    If you've got any question feel free to ask.

    Good luck!
    Where did I put my coffee cup?
    dir -R /home/* | grep "coffee cup"

Page 1 of 2 12 LastLast

Posting Permissions

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