LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices

Reply
 
Search this Thread
Old 04-19-2005, 05:53 AM   #1
Moataz
LQ Newbie
 
Registered: Apr 2005
Location: Egypt
Posts: 10

Rep: Reputation: 0
Command not found


I installed Red Hat 9 with win98 and winXP
when I try to issue the commands useradd, usermod, or userdel
it gives me the following error message:

bash: useradd: command not found
bash: usermod: command not found
bash: userdel: command not found

I checked these commands in the following path and I found them
/usr/sbin/useradd
/usr/sbin/usermod
/usr/sbin/userdel

what does that mean ????


in Red Hat 9 I can add, modify, or delete users in a graphical way but i want to do this from the command line

Thanks in advance
Moataz-Bellah R. Mishrif
MoatazRashad@yahoo.com
 
Old 04-19-2005, 05:56 AM   #2
bob_man_uk
Member
 
Registered: Jul 2003
Location: uk
Posts: 80

Rep: Reputation: 16
if you actually go into /usr/sbin and run the commands with ./ before the commands, does that make a difference?
 
Old 04-19-2005, 05:58 AM   #3
Goala
Member
 
Registered: May 2004
Location: Merida (Spain)
Distribution: Debian
Posts: 89

Rep: Reputation: 15
First, you have to execute these commands as root.

Second, watch your root's PATH environment variable (echo $PATH) to see if the /usr/sbin path is in it.

Third, if you answer "no" to the last question, add it, editing /home/root/.profile file, adding a line like this:
PATH=$PATH:/usr/sbin
 
Old 04-25-2005, 05:49 AM   #4
Moataz
LQ Newbie
 
Registered: Apr 2005
Location: Egypt
Posts: 10

Original Poster
Rep: Reputation: 0
Question Command not found

what does it mean by: ( ./ ) before the command

????????????????
 
Old 04-25-2005, 06:10 AM   #5
bob_man_uk
Member
 
Registered: Jul 2003
Location: uk
Posts: 80

Rep: Reputation: 16
i mean sometimes commands dont have the correct permissions to execute thus requiring you to put ./ in fromnt of them, you must be in the directory of the program to run it

E.G

Code:
[root@mypc root]# cd /
[root@mypc /]# cd /usr/sbin
[root@mypc sbin]# ./useradd
usage: useradd  [-u uid [-o]] [-g group] [-G group,...]
                [-d home] [-s shell] [-c comment] [-m [-k template]]
                [-f inactive] [-e expire ] [-p passwd] [-M] [-n] [-r] name
       useradd  -D [-g group] [-b base] [-s shell]
                [-f inactive] [-e expire ]
[root@mypc sbin]#
if you dont get the usage: useradd then your program might be broken, have you tried goala's answer?

if you are at the command line as yourself then you will get that error message, type "su -" and it will ask for a password type in the root password and then try typing useradd etc im sure it will work,

MattyG
 
Old 04-25-2005, 03:15 PM   #6
Moataz
LQ Newbie
 
Registered: Apr 2005
Location: Egypt
Posts: 10

Original Poster
Rep: Reputation: 0
Command not found

I've tried Goala's answer by puting ./ before the command and it works fine.
Also I edited /home/root/.bash_profile file, added the line: PATH=$PATH:/usr/sbin, it works fine, thanks guys

I have another question:
What is the difference between [su] and [su -] because I have to execute [su -] to be able to use useradd?
but if I execute [su] and then execute the command useradd it gives me: Command not found
 
Old 04-26-2005, 02:46 AM   #7
bob_man_uk
Member
 
Registered: Jul 2003
Location: uk
Posts: 80

Rep: Reputation: 16
I told you about putting ./ infront of the command which by the way still wouldnt have worked unless you were as root, as for your second question, su just emulates a user login but doesnt set up all the profiles, su - however is just like logging in on a terminal, it set up all the profiles and permissions, i pulled this info from an old unix manual.

hope this helps.

MattyG
 
1 members found this post helpful.
Old 04-26-2005, 08:08 AM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,969

Rep: Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752
su uses the current logged in users environment.
su - uses root's environment.


./ is a shortcut for current working directory.
 
1 members found this post helpful.
Old 08-20-2009, 02:27 PM   #9
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,547

Rep: Reputation: 37
I had the same problem. what fixed it for me was doing su - instead of just su. never knew the difference, thanks!
 
1 members found this post helpful.
Old 08-21-2009, 01:32 AM   #10
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,289

Rep: Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034
Actually, its not just root. Anytime you use the

su

OR

su <target username>

cmd, you only connect as that user (or root if no user specified), but you retain your original env settings. Adding the '-' gives you the target user's settings, exactly as if you had logged in as him/her ie

su - (for root)

or

su - <target username> (for other users)
 
Old 03-30-2010, 03:13 AM   #11
penguin_eater
LQ Newbie
 
Registered: Mar 2010
Posts: 1

Rep: Reputation: 0
Thumbs up

Quote:
Originally Posted by Goala View Post
First, you have to execute these commands as root.

Second, watch your root's PATH environment variable (echo $PATH) to see if the /usr/sbin path is in it.

Third, if you answer "no" to the last question, add it, editing /home/root/.profile file, adding a line like this:
PATH=$PATH:/usr/sbin
************************************************************************Hey i did as GOALA suggested.
works like a charm now!!!

Thanks mate
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
bash: <command name> command not found smash Programming 5 03-13-2006 08:48 AM
command not found peterstudent Linux - Newbie 2 01-21-2005 07:59 PM
du: command not found Wyk3d Mandriva 2 10-30-2004 03:50 PM
Command not found weaver2112 Linux - General 6 06-26-2003 09:40 PM
command not found jkp Linux - Newbie 3 01-21-2003 02:26 PM


All times are GMT -5. The time now is 04:49 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration