LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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-30-2004, 08:37 PM   #1
keysorsoze
Member
 
Registered: Apr 2004
Location: Queens, NY
Distribution: Red Hat, Solaris
Posts: 295

Rep: Reputation: 30
Useradd command not found.


Hi!, I am trying to add a user for samba, however, when I login as root in the command terminal and type useradd followed the the name of the user, I recieve command not found. Any help would be appreciated.

Thanks
 
Old 04-30-2004, 08:58 PM   #2
odious1
Member
 
Registered: Jun 2003
Location: Virginia, USA
Distribution: Slackware
Posts: 252

Rep: Reputation: 30
try /usr/sbin/useradd newuser. This should work. You will want to look at your path echo $PATH and change that to include the /usr/sbin path.

Tom
 
Old 04-30-2004, 08:59 PM   #3
odious1
Member
 
Registered: Jun 2003
Location: Virginia, USA
Distribution: Slackware
Posts: 252

Rep: Reputation: 30
Oops, forgot then you will want to smbpasswd -a newuser to creat samba account.

Tom
 
Old 04-30-2004, 09:54 PM   #4
keysorsoze
Member
 
Registered: Apr 2004
Location: Queens, NY
Distribution: Red Hat, Solaris
Posts: 295

Original Poster
Rep: Reputation: 30
Thanks for the reply, I entered the command like you said but I am still recieving nothing. Im using redhat 9.0 right now here is the output from my terminal. Please let me know what I am doing wrong. Thanks.
[keysorsoze@localhost keysorsoze]$ su
Password:
su: incorrect password
[keysorsoze@localhost keysorsoze]$ su
Password:
[root@localhost keysorsoze]# useradd
bash: useradd: command not found
[root@localhost keysorsoze]# ?
bash: ?: command not found
[root@localhost keysorsoze]#
[root@localhost keysorsoze]# /user/sbin/useradd
bash: /user/sbin/useradd: No such file or directory
[root@localhost keysorsoze]# cd /user
bash: cd: /user: No such file or directory
[root@localhost keysorsoze]# cd /
[root@localhost /]# cd /user/sbin/useradd
bash: cd: /user/sbin/useradd: No such file or directory
[root@localhost /]# cd /user
bash: cd: /user: No such file or directory
[root@localhost /]# cd user/
bash: cd: user/: No such file or directory
[root@localhost /]# user/sbin/useradd
bash: user/sbin/useradd: No such file or directory
[root@localhost /]# cd /user/sbin path
bash: cd: /user/sbin: No such file or directory
[root@localhost /]# su
[root@localhost /]# useradd
bash: useradd: command not found
[root@localhost /]#

Thanks for the help the response time is incredible.
 
Old 04-30-2004, 10:36 PM   #5
kvedaa
Member
 
Registered: Mar 2004
Location: Virginia
Distribution: PacketProtector
Posts: 331

Rep: Reputation: 30
Keysorsoze,

It looks like you may have made one of the common mistakes when getting used to navigating through linux/unix. It seems that you have attempted to change to the 'user' directory vice the 'usr' directory.

Another thing that might help, when you perform the 'su' to go to root you might want to try 'su -' instead. The difference between the two, is without the dash it will not invoke the user environment for the user that you are switching to, where if you do use the dash it will take you to that users home directory and run all of the profile information for that account (such as modifications for paths). Hence with the 'su -' you will likely be able to use both the useradd and the smbpasswd commands without needing to specify the path.

I am running Fedora Core 1, which should be very similar to your RH9 install.

[kvedaa@mobilev kvedaa]$ su -
Password:
[root@mobilev root]# which useradd
/usr/sbin/useradd
[root@mobilev root]# which smbpasswd
/usr/bin/smbpasswd
[root@mobilev root]# cd /usr/sbin
[root@mobilev sbin]# ls -l | grep useradd
lrwxrwxrwx 1 root root 7 Feb 16 20:05 adduser -> useradd
-rwxr-xr-x 1 root root 23756 Jun 5 2003 luseradd
-rwxr-xr-x 1 root root 57380 Oct 22 2003 useradd
[root@mobilev sbin]#


I hope this helps.
 
Old 04-30-2004, 11:02 PM   #6
keysorsoze
Member
 
Registered: Apr 2004
Location: Queens, NY
Distribution: Red Hat, Solaris
Posts: 295

Original Poster
Rep: Reputation: 30
Kvedaa, thanks for the help I suppose that we added a user named useradd here? I don't really get some of the commands or what they mean, let's say I wanted to add a user named splash for instance, does that go after grep? Thanks for the assistance, I would be tearing out my hair right now if it wasn't for the assistance.



[keysorsoze@localhost keysorsoze]$ su -
Password:
[root@localhost root]# which useradd
/usr/sbin/useradd
[root@localhost root]# which smbpasswd
/usr/bin/smbpasswd
[root@localhost root]# cd /user/sbin
-bash: cd: /user/sbin: No such file or directory
[root@localhost root]# cd /usr/sbin
[root@localhost sbin]# ls -l l grep useradd
ls: l: No such file or directory
ls: grep: No such file or directory
-rwxr-xr-x 1 root root 56088 Feb 12 2003 useradd
[root@localhost sbin]# ls -l l grep useradd
ls: l: No such file or directory
ls: grep: No such file or directory
-rwxr-xr-x 1 root root 56088 Feb 12 2003 useradd
[root@localhost sbin]# ls -l | grep useradd
lrwxrwxrwx 1 root root 7 Mar 5 1999 adduser -> useradd
-rwxr-xr-x 1 root root 20600 Feb 19 2003 luseradd
-rwxr-xr-x 1 root root 56088 Feb 12 2003 useradd
[root@localhost sbin]#
 
Old 05-01-2004, 12:48 AM   #7
fractal_chaos
Member
 
Registered: Aug 2003
Location: long island, ny
Distribution: RH, SuSE, FC
Posts: 59

Rep: Reputation: 15
you can read more about the useradd command by looking at the man page:

type 'man useradd'

to add a user:

(as root) type 'useradd tux'

you just added a user named tux. by default, a new directory was created for tux in /home/ called /home/tux/ .

to make a passwd for tux,

(as root) type 'passwd tux'

for samba stuff, i'm afraid i don't have much experience, but perhaps you can follow odius1's comments above.
 
Old 05-01-2004, 12:57 PM   #8
kvedaa
Member
 
Registered: Mar 2004
Location: Virginia
Distribution: PacketProtector
Posts: 331

Rep: Reputation: 30
Keysorsoze,

I am sorry, I was not clear on why I used the 'grep' in my example. You will see that I used the 'which' command to look through my search path for a item by the name that I follwed the command with, Example:

[root@mobilev root]# which useradd
/usr/sbin/useradd

Here as the root user, I used the 'which' command to ask which 'useradd' would be run if I were to call for it without explicitly giving the full path.

Then I went to that directory ('/usr/sbin') and I used the 'ls -l' command to see a long listing of the directory, but I know that this directory has a far to many files for me to display here on this board, so I decide to reduce it only to those items that I am interested in for the moment. To do this I follow up the 'ls -l' with a pipe (|), which for lack of a better description tells the computer to run the previous command, then hold onto the output (instead of showing it on the screen), then run this output through the command that comes after the pipe (|). Hence I will have the say 70 lines of text from the 'ls -l' request that I made, then after the pipe, I have a 'grep useradd'. The 'grep' will go through these 70 lines of text and select only those line that have 'useradd' in them, only these lines will be displayed.

Now if you want to use the 'useradd' command to create a user called bubba, you want to be sure you log in as root with the 'su -' command (remember that the dash will ensure that you take the environment of the user that you are changing to, including in this case the PATH for root). Now that you are root you can verify that the command that you want is on your path (this is an optional step) by using the 'which' command, then you can add the user 'useradd bubba', after this you will want to set a password for the user using 'passwd bubba'. All told it should look something like this.

[kvedaa@mobilev kvedaa]$ su -
Password:
[root@mobilev root]# which useradd
/usr/sbin/useradd
[root@mobilev root]# useradd bubba
[root@mobilev root]# passwd bubba
Changing password for user bubba.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@mobilev root]#
 
Old 05-01-2004, 03:17 PM   #9
keysorsoze
Member
 
Registered: Apr 2004
Location: Queens, NY
Distribution: Red Hat, Solaris
Posts: 295

Original Poster
Rep: Reputation: 30
kvedaa

Thanks a lot for the help this explanation, it helped a ton. Finally I can get back to messing with the samba side of things instead of trying to add a user. It was just confusing that you cannot just type useradd followed by the user when your in root. This explanation really helped.

Thanks.
 
  


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
useradd not found, but shadow is installed Ziax Fedora 2 10-16-2005 05:37 AM
useradd command Wolvastur Linux - Newbie 9 01-25-2005 10:01 AM
bash: useradd: command not found KennyK Linux - Software 2 04-17-2003 09:02 AM
useradd command allancondino Linux - General 5 04-27-2002 12:01 PM
bash: useradd: command not found 360 Linux - Networking 4 08-23-2001 09:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 08:06 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration