LinuxQuestions.org
Visit Jeremy's Blog.
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 08-14-2011, 04:02 AM   #1
bhavinder
LQ Newbie
 
Registered: Aug 2011
Posts: 2

Rep: Reputation: Disabled
Smile /usr/sbin


Hi Guys,

I am new to this forum so please forgive me if you find me wrong.

I am trying to create a new user in my system.

However when i try to run cmd useradd it throws an error "command not found"
.
When I run /usr/sbin/useradd it is working.

Could you please help me with the reason behind this.

Is it normal system behavior or there is some problem with the system variables.

Please help .

Bhavinder
 
Old 08-14-2011, 04:07 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Are you trying to execute this command as root user or as a normal user?

It should be executed by the root user.

Hope this helps.
 
Old 08-14-2011, 04:08 AM   #3
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Hello bhavinder, welcome to LQ,

which distribution are you using?

If /usr/sbin/... is found belongs to the path, on Slackware for example the /.../sbin/ pathes are only available for root (by default).

You may execute the command
Code:
env | grep -i path
to understand how the pathes are configured on your system. You can es well use this command as root and as a normal user and see what's the difference.

Markus
 
Old 08-14-2011, 04:10 AM   #4
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,465

Rep: Reputation: Disabled
Hi and welcome to LQ!
/usr/sbin is not in the path of ordinary users. So if you type just useradd, and your not logged in as root then your system won't find anything in sbin. This behaviour is entirely normal and also sensible. programs found in sbin are those which should be run by a system administrator. This is part of Linux security.
ciao,
jdk
 
Old 08-14-2011, 06:06 AM   #5
EmaRsk
Member
 
Registered: Mar 2006
Distribution: Mint, WSL Ubuntu
Posts: 134

Rep: Reputation: 32
A quick check:
Code:
echo $PATH
shows where commands are searched when you run them as user, while
Code:
sudo echo $PATH
shows where they are looked for when run with sudo.
 
Old 08-14-2011, 10:23 AM   #6
bhavinder
LQ Newbie
 
Registered: Aug 2011
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thanks a lot guys....

I never thought that I would get such a warm welcome and quick response to my query.

Thanks again.....

Will check all the suggestions
 
  


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
/usr/sbin/httpd: symbol lookup error: /usr/sbin/httpd: undefined symbol: apr_atomic_x dasoberdick Slackware 16 10-11-2014 02:36 AM
What is difference between /usr/sbin/ps & /usr/ucb/ps command rajaniyer123 Solaris / OpenSolaris 6 07-05-2007 12:53 PM
making files available in /usr/local/bin and /usr/sbin reakinator Linux - Newbie 1 10-14-2006 05:09 PM
/usr/sbin and /sbin world read/executable... why? lazlow69 Slackware 3 04-29-2004 05:06 PM
As root, not seeing /sbin and /usr/sbin in path weghman Linux - Newbie 3 04-25-2004 01:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:34 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
Open Source Consulting | Domain Registration