Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
root# useradd -g slaves mike root# passwd mike Set the password and log in as 'mike'. I want to give this user very high power. Almost as much as root. ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2004
    Location
    Calgary Alberta Canada
    Posts
    15

    New User Can't do A thing


    root# useradd -g slaves mike
    root# passwd mike

    Set the password and log in as 'mike'. I want to give this user very high power. Almost as much as root. but when I run almost any command, it goes :

    -bash: $cmd: command not found.

    I set up sudo to give mike all access but still doesn't work.
    Keep getting command not found.

  2. #2
    Linux Guru
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    3,284
    what EXACTLY are you trying to run. Can you give the exact command your running? Have you setup the necessary $PATH variable and other environment variables?

  3. #3
    Just Joined!
    Join Date
    Jul 2004
    Location
    Calgary Alberta Canada
    Posts
    15
    $PATH variable and other environment variables???

    useradd
    groupadd
    asterisk -r (our soft PBX command line) <- most important

    and probably some others

  4. #4
    Linux Guru kkubasik's Avatar
    Join Date
    Mar 2004
    Location
    Lat: 39:03:51N Lon: 77:14:37W
    Posts
    2,396
    cmd is a windows command to open cli, if you are trying another command press tab halfway throuhg and it will show you all the possible ways to finish that command
    Avoid the Gates of Hell. Use Linux
    A Penny for your Thoughts

    Formerly Known as qub333

  5. #5
    Just Joined!
    Join Date
    Jul 2004
    Location
    Calgary Alberta Canada
    Posts
    15
    I think your lost qub.

  6. #6
    Just Joined!
    Join Date
    May 2004
    Location
    Pennsylvania
    Posts
    98
    can you run the command as root?

    sounds like you are not typing the correct path for the command.

    $PATH is an environment variable which is a list of paths to look in when a command is pressed.

    for example, if you can type
    Code:
    su -
    then the comman su is in you're path.

    if the above command fails (with "command not found") then su is not in your path and you have to type the full path to the command.
    Code:
    /bin/su -
    a quick way to check if the command you are running is in your $PATH is the "which" command

    Code:
    which su
    /bin/su
    which will tell you the full path of the command if its in your $PATH. (there's a little more to it than that, but thats a good general use)

  7. #7
    Just Joined!
    Join Date
    Jul 2004
    Location
    Calgary Alberta Canada
    Posts
    15
    You Nailed it on the nose... Now how do I set it so I don't have to type /usr/sbin/useradd all the time? I just want everything to work as it does as root.

  8. #8
    Linux User
    Join Date
    Jul 2004
    Posts
    256
    Quote Originally Posted by manipura
    You Nailed it on the nose... Now how do I set it so I don't have to type /usr/sbin/useradd all the time? I just want everything to work as it does as root.
    To run a program/script you need the full path. Or the path can be in the PATH environment variable.
    --monkey

  9. #9
    Linux Newbie
    Join Date
    May 2004
    Location
    Boston, MA
    Posts
    246
    When you're root, type
    Code:
    echo $PATH
    This will give you the contents of the PATH variable, which tells Linux where to look for commands that are typed in a terminal. Copy that text to a file with
    Code:
    echo $PATH > /home/mike/path.txt
    or something, and then switch to your mike account and type
    Code:
    PATH = `cat path.txt`
    Then you should be alright. Good luck.

    EDIT: solman66's answer is more thorough. Listen to him, not me.
    Situations arise because of the weather,
    And no kinds of love are better than others.

  10. #10
    Just Joined!
    Join Date
    May 2004
    Location
    Pennsylvania
    Posts
    98
    ok, to set the $PATH variable to be the exact same as roots this is how i would do it.... there may be an easier way, but this will work.


    As root (in a directory that you're other user has read access in)
    Code:
    echo $PATH > my_path
    this prints the value stored in $PATH into the file "my_path"

    next
    As the user you want to give the path to
    Code:
    cat my_path >> ~/.bashrc
    **Note the "dot"
    What this does is take the contents from the file and places them at the end of the .bashrc file in your home directory (this file is loaded when you log in to set variables and such)

    next
    As the user you want to give the path to
    open the ".bashrc" file in your favorite editor
    The last line should contain the path.
    Now you have to add this before it

    Code:
    export PATH=$PATH&#58;&#91;i&#93;the rest of the path from root&#91;/i&#93;
    export sets the variable.
    you should set PATH equal to $PATH + the new path, just in case there was something different.

    save the file, log out, log in and try it
    (don't forget to clean up the my_path file.... i hate messy file systems)

    I just realized you could do this as root without the use of an extra file
    Code:
    echo $PATH >> /home/user/.bashrc
    and then edit the .bashrc file as the user like i said above

Page 1 of 2 1 2 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
  •