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!

useradd invalid syntax

Status
Not open for further replies.

andysys

IS-IT--Management
May 20, 2003
103
IN
Hi Folks,

I have Solaris 9 box.Getting error while creating user.

Error message -
# useradd
UX: useradd: ERROR: invalid syntax.
usage: useradd [-u uid [-o] | -g group | -G group[[,group]...] | -d dir |
-s shell | -c comment | -m [-k skel_dir] | -f inactive |
-e expire | -A authorization [, authorization ...] |
-P profile [, profile ...] | -R role [, role ...]]
-p project [, project ...] login
useradd -D [-g group | -b base_dir | -f inactive | -e expire
-A authorization [, authorization ...] |
-P profile [, profile ...] | -R role [, role ...]] |
-p project
#

If I do manual user creation.i.e.Modifying password & shadow files it works.I am able login with this new user.
Kernel patch level is 118558-20.

Has anyone come across this problem.

Andy


 
Are you just typing useradd and nothing else? This is why the error appears. At the bare minimum you should have useradd <username>
 
Here is the syntax I use with useradd.

useradd -u <userid> -g <groupid> -c "Comments: Users Name and Contact Information" -d /home/<username> -s /bin/csh <username>

So if I was going to create a user account for myself:

useradd -u bfitzmai -g 14 -c "Bruce ###-###-####" -d /home/bfitzmai -s /bin/csh bfitzmai

The -d is set to /home because I use NIS automount entries in /etc/auto_home. If you are not using automount, this entry may look like "-d /export/home/bfitzmai"

Once you create the new user, run command passwd <username> to set the password.

admintool is still available in Solaris 9. This is a GUI that can be used to create and modify users.
 
Hello Folks,

Thanks for your responses.

Actually it's not a syntax problem.I already coonfirmed that.

Could it be something related to RBAC.How I can disable RBAC if configured any.

Andy
 
What error are you getting? Is it simply "UX: useradd: ERROR: invalid syntax."? If that's all it is, then like the others have said, you simply havent provided the command line options. The absolute minimum is useradd username.

Annihilannic.
 
Thanks!

Actuially I tried useradd username & all combinations for useradd however getting same error.

Andy
 
And the error is....? Can you paste a copy of output including the command you specified, with a username?

Annihilannic.
 
Thanks Annihilannic.

Here is the output -
# useradd sysadm
UX: useradd: ERROR: invalid syntax.
usage: useradd [-u uid [-o] | -g group | -G group[[,group]...] | -d dir |
-s shell | -c comment | -m [-k skel_dir] | -f inactive |
-e expire | -A authorization [, authorization ...] |
-P profile [, profile ...] | -R role [, role ...]]
-p project [, project ...] login
useradd -D [-g group | -b base_dir | -f inactive | -e expire
-A authorization [, authorization ...] |
-P profile [, profile ...] | -R role [, role ...]] |
-p project
# useradd -m -d /home/sysadm sysadm
UX: useradd: ERROR: invalid syntax.
usage: useradd [-u uid [-o] | -g group | -G group[[,group]...] | -d dir |
-s shell | -c comment | -m [-k skel_dir] | -f inactive |
-e expire | -A authorization [, authorization ...] |
-P profile [, profile ...] | -R role [, role ...]]
-p project [, project ...] login
useradd -D [-g group | -b base_dir | -f inactive | -e expire
-A authorization [, authorization ...] |
-P profile [, profile ...] | -R role [, role ...]] |
-p project
#

Andy
 
Thanks. What are the contents of /usr/sadm/defadduser? Does useradd -D work to display the defaults defined in that file?

Annihilannic.
 
Hi

Here is the o/p -
# cat /usr/sadm/defadduser
# Default values for useradd. Changed Wed Aug 8 02:05:00 2007

defgroup=1
defgname=other
defparent=/export/home
defskel=/etc/skel
defshell=/bin/sh
definact=0
defexpire=04/30/2007
defauthorization=
defprofile=
defproj=0
defprojname=default
defrole=
# useradd -D
group=other,1 project=default,0 basedir=/export/home
skel=/etc/skel shell=/bin/sh inactive=0
expire=04/30/2007 auths= profiles= roles=
#
 
Hi Annihilannic,

Thanks.Do you mean to point it to expiry date of accounts.

Andy
 
Annihilannic,

Thanks again.From where I can change the expiry date.
Just to update you I can create user accounts using admintool & smc but not using useradd command.

Andy
 
Either vi that file and remove the date, or use useradd -D -e <newdate> to change it to a new date, or useradd -D -e "" to remove it completely.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top