LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-21-2012, 04:28 PM   #1
kohshan99
Member
 
Registered: Sep 2012
Posts: 50

Rep: Reputation: Disabled
Unhappy Bash: Command Not Found


I installed Red Hat Enterprises 5
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 ????

pleassssss help meeee
 
Old 09-21-2012, 04:59 PM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Hi and welcome to LinuxQuestions!

Most likely you are trying these commands as a normal user, whereas they are system commands reserved to the system administrator (that is the Linux super-user, named root). As you can see they are in the /usr/sbin directory, that according to the Filesystem Hierarchy Standard contains commands for which root's privileges are required.

Indeed, if you check your PATH environment variable:
Code:
echo $PATH
you cannot see /sbin nor /usr/sbin in the (colon separated) list of directories, hence the command not found error. On the contrary, if you gain root's privileges you will see them listed and you'll have these commands at your disposal.

In addition to the official Red Hat documentation, I suggest the more friendly "The Linux Command Line" book, that explains these basic concepts in a plain and clear way.
 
Old 09-23-2012, 08:55 AM   #3
kohshan99
Member
 
Registered: Sep 2012
Posts: 50

Original Poster
Rep: Reputation: Disabled
Unhappy

when im using Level 5 then its works. but in GUI mode (level 7) didn't work....
 
Old 09-23-2012, 10:16 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
I don't know what level 5 and level 7 are----it sounds like level 5 might have a root environment (different $PATH)

Check the PATH in both levels---but also try to simply enter "su" in a terminal to switch to root user.
 
Old 09-24-2012, 01:40 AM   #5
kohshan99
Member
 
Registered: Sep 2012
Posts: 50

Original Poster
Rep: Reputation: Disabled
its called RUN Level's.

Alt+Ctrl+F5 or Alt+Ctrl (F1 to F7)

F7 is full GUI mode.
 
Old 09-24-2012, 03:44 AM   #6
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
As a normal user, PATH does not include everything /sbin. Also, executables in /sbin are normally only executable by an EUID 0 user or root.
 
Old 09-24-2012, 04:08 AM   #7
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,110

Rep: Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268
no, that is not run level (I think). Alt+Ctrl+F5 will give you a command window where you can log in as root, Alt+Ctrl F7 will give you a GUI where usually normal users are logged in.
/usr/sbin is available only for root, normal users are not allowed to use those tools (as it was mentioned before)
 
Old 09-24-2012, 06:01 AM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
Indeed, runlevels are not the same as different login screens https://en.wikipedia.org/wiki/Runlev...nux_and_Fedora
 
Old 09-24-2012, 02:02 PM   #9
mandyapenguin
Member
 
Registered: Nov 2011
Location: India
Distribution: RedHat, Cent OS, Fedora, Debian, Ubuntu
Posts: 106

Rep: Reputation: Disabled
Quote:
Originally Posted by kohshan99 View Post
when im using Level 5 then its works. but in GUI mode (level 7) didn't work....
The reason of "command not found" is already said in colucix post itself.
run
Code:
whereis useradd
whereis userdel
whereis usermod
As a root or super user check whether or not the path is set to environment variables using
Code:
env | grep PATH
or
echo $PATH
If not, then set path variable using
Code:
export PATH=/sbin/:$PATH
or
export PATH=/usr/sbin/:$PATH
or whereever you find the path from whereis command. And then excecute useradd, userdel, usermod commands as root/super user, or simply use full path whichever you have found from whereis command like
Code:
/usr/sbin/useradd username
And dont get confuse with runlevels and terminals

Last edited by mandyapenguin; 09-24-2012 at 02:04 PM.
 
1 members found this post helpful.
Old 09-25-2012, 02:11 AM   #10
kohshan99
Member
 
Registered: Sep 2012
Posts: 50

Original Poster
Rep: Reputation: Disabled
Thumbs up

Thank u friends... Problem is solved... & once again thanks for help...
 
  


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: ns: command not found using ns-2.31 Vixxx Linux - Software 23 11-12-2012 04:45 AM
bash: ls-l:command not found umeshgupta1987 Linux - Newbie 1 10-03-2010 07:46 AM
Bash command not found Legolas327 Linux - Newbie 9 06-27-2007 08:44 PM
bash: rpm: command not found && sudo: alien: command not found Java_Code Ubuntu 7 07-28-2006 12:57 AM
bash : q : command not found (need help) JesseMor Linux - General 5 01-27-2006 01:57 AM


All times are GMT -5. The time now is 08:44 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration