Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
google site



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Reply
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-12-2010
Registered User
 

Join Date: Oct 2009
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
why sudo doesn't work?


Code:
[test@manager ~]$ sudo -l
User test may run the following commands on this host:
    (ALL) ALL
[test@manager ~]$ sudo ls /root
anaconda-ks.cfg  Desktop      install.log.syslog                     l.of             page.html  VTune
cpi              ex           intel                                  mpd.hosts        #te.c#     workspace
cpi.c            ex1.c        libxrdisk_1_BPET46J_02_09_14.so.1.0.0  my_page          te.c       x
deli             install.log  list_disk_space_used_by_users.sh       mysqlaccess.log  test       xCATdb-dump
[test@manager ~]$ sudo useradd myuser
sudo: useradd: command not found
[test@manager ~]$

command "sudo ls" works, but why "sudo useradd myuser" doesn't work??
Sponsored Links
  #2  
Old 03-12-2010
pludi's Avatar
pludi pludi is online now Forum Staff  
Moderator
 

Join Date: Dec 2008
Location: Sqrt[-e^(-2 i Pi)]
Posts: 3,790
Thanks: 1
Thanked 63 Times in 60 Posts
Probably because useradd isn't in your path and has to be called using the full path (eg /usr/sbin/useradd). The reason simply is that sudo doesn't change the environment in any way, it just performs an ID change.
  #3  
Old 03-15-2010
Registered User
 

Join Date: Oct 2009
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
You are correct.
But if I want to use command sudo cd /root ,
how do I use the full path of command cd?

Code:
[test@manager proc]$ whereis cd
cd: /usr/share/man/man1/cd.1.gz /usr/share/man/man1p/cd.1p.gz /usr/share/man/mann/cd.n.gz

I cann't know the full path of cd


Thanks!
  #4  
Old 03-16-2010
pludi's Avatar
pludi pludi is online now Forum Staff  
Moderator
 

Join Date: Dec 2008
Location: Sqrt[-e^(-2 i Pi)]
Posts: 3,790
Thanks: 1
Thanked 63 Times in 60 Posts
That's because cd isn't a program, but a shell-builtin. Always. It wouldn't be useful as a standalone utility, as it can't change the working directory of any other program.
  #5  
Old 03-18-2010
Registered User
 

Join Date: Oct 2008
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
Just edit .profile and find your path and add /sbin , relaunch a shell and try it again.
Sponsored Links
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Unable to use the Sudo command. "0509-130 Symbol resolution failed for sudo because:" Chloe123 UNIX for Dummies Questions & Answers 1 12-21-2009 04:09 PM
sudo and su - melanie_pfefer UNIX for Dummies Questions & Answers 1 03-10-2008 01:23 PM
sudo, or not sudo: that is the question Linux Bot UNIX and Linux RSS News 1 02-07-2008 12:40 PM
About sudo ust UNIX for Advanced & Expert Users 1 07-25-2007 06:51 AM
Script doesn't work, but commands inside work cheongww UNIX for Dummies Questions & Answers 2 11-14-2006 09:52 PM



All times are GMT -4. The time now is 07:57 AM.