Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can't use useradd at terminal 1

Status
Not open for further replies.

jaazman

Technical User
Feb 20, 2003
5
US
I log-in as a normal user and then use the su command to become a superuser everything is alright until I want to add a user using USERADD, the system says it can't find the command. I know the command is there because I found it when I searched for it and if I go to the machine and log on as root it works, so why I can't use it when I am a su?
Can somebody tell me what's wrong? Thanks

 
Are you issuing "su root" or "su - root".

The latter makes your new shell a login shell, which will read root's .rc files and set up the environment exactly as if you were root.

Without the dash (or "-l" or "--login", they all do the same thing), you're logged in as root, but using your original user's environment.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
You need to edit /etc/profile for that user... you can specify the PATH where commands are executed...see file example below.

To execute the command you will need to know where the command is located... /usr/sbin/

You can type the fullname of the command and not worry about editing the /etc/profile however it becomes redudant to continue to remember where all the commands are stored.
[Example]
/usr/sbin/useradd

Hope this helps if you need help on the profile I have copied one below the profile is located in /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

if [ `id -u` = 0 ]
then
PATH="$PATH:/usr/lib/sf/support/scripts"
else
PATH="$PATH:/usr/lib/sf/support/scripts:/sbin:/usr/sbin"
fi

pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}

# Path manipulation


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top