Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Adding Users in Solaris 2.5.1

100 views
Skip to first unread message

Dan Anderson

unread,
Oct 28, 1997, 3:00:00 AM10/28/97
to

adduser, or something like that.

"James Beltran" <a-j...@microsoft.com> wrote:
>Is there a way to add users without using the ADMINTOOL utility?
>A command line interace alternative? I am behind a proxy server
>and cannot open a x session to open the admintool utility.

-
Dan Anderson <spam-reg...@news.fuller.edu>
San Diego, California, USA
dan
- @ -
cts.com

James Beltran

unread,
Oct 28, 1997, 3:00:00 AM10/28/97
to

Is there a way to add users without using the ADMINTOOL utility?
A command line interace alternative? I am behind a proxy server
and cannot open a x session to open the admintool utility.

Any help would be great.

James

--
The opinions expressed in this message are my own personal views
and do not reflect the official views of the Microsoft Corporation.

Sunil Kandwala

unread,
Oct 28, 1997, 3:00:00 AM10/28/97
to

In article <34566c3d...@nntp.cts.com>,

Dan Anderson <spam-reg...@news.fuller.edu> wrote:
>adduser, or something like that.
>
>"James Beltran" <a-j...@microsoft.com> wrote:
>>Is there a way to add users without using the ADMINTOOL utility?
>>A command line interace alternative? I am behind a proxy server
>>and cannot open a x session to open the admintool utility.
>
>-
>Dan Anderson <spam-reg...@news.fuller.edu>
>San Diego, California, USA
> dan
> - @ -
>cts.com

Yes, edit /etc/passwd and /etc/shadow and add the new user, then create
user dir as specified in /etc/passwd.

--Sunil

Ranko Popovic

unread,
Oct 29, 1997, 3:00:00 AM10/29/97
to

James Beltran <a-j...@microsoft.com> wrote in article
<635lpb$9...@news.microsoft.com>...

> Is there a way to add users without using the ADMINTOOL utility?

man useradd

Anthony Mandic

unread,
Oct 29, 1997, 3:00:00 AM10/29/97
to

Mike D. Kail wrote:

>
> On 28 Oct 1997 22:09:34 -0600, Sunil Kandwala <skha...@xnet.com> wrote:
>
> >Yes, edit /etc/passwd and /etc/shadow and add the new user, then create
> >user dir as specified in /etc/passwd.
>
> 'useradd' is *much* easier, but if you do insist on editing the
> /etc/passwd and /etc/shadow files you *must* do a 'pwconv' after you're
> done editing

Since when? If you manually edit /etc/shadow correctly, pwconv is not
required.

-am

Frederic Goudal

unread,
Oct 29, 1997, 3:00:00 AM10/29/97
to

"James Beltran" <a-j...@microsoft.com> writes:

>
> Is there a way to add users without using the ADMINTOOL utility?

> A command line interace alternative? I am behind a proxy server
> and cannot open a x session to open the admintool utility.
>

> Any help would be great.

Edit the passwd file with you favorite editor.
use mkdir to create the directory
use chgrp chown to give it to the user.


f.g.
P.S. I just hate click-o-rama...

--
Look at the things around you, the immediate world around you. If you are
alive, it will mean something to you, and if you care enough about
photography, and if you know how to use it, you will want to photograph that
meaningness. If you let other people's vision get between the world and your
own, you will achieve that extremely common and worthless thing, a pictorial
photograph.

Paul Strand "The Art Motive in Photography" the British Journal of Photography
1923, p 613
Frederic Goudal - gou...@enserb.u-bordeaux.fr - http://www.insat.com/~filh -

Donald S. Bryant

unread,
Oct 29, 1997, 3:00:00 AM10/29/97
to Frederic Goudal

One more thing if you do edit the passwd and group files yourself, use
the pwck and grpck programs to check your edits for errors.

Don


Sunil Kandwala

unread,
Oct 29, 1997, 3:00:00 AM10/29/97
to

In article <637jkt$f...@bgtnsc01.worldnet.att.net>,
Donald S. Bryant <dsbr...@worldnet.att.net> wrote:
>The useradd, usermod, and userdel utilities allow you to manage user
>accounts with a command line utility. This eliminates doing all the
>footwork yourself, such as editing the passwd file, creating user home
>directories etc.
>
>Don
>

This is difficult to do ???

vi /etc/passwd
vi /etc/shadow
mkdir userdir
chmod 755 userdir
chown username userdir
chgrp usergroup userdir

All that useradd etc., do is hide details that a sysadmin type is supposed to
know anyway. And this is the simple stuff...

--Sunil

BRANDON WILLIAM HUME

unread,
Oct 29, 1997, 3:00:00 AM10/29/97
to

Sunil Kandwala (skha...@xnet.com) wrote:
: This is difficult to do ???

: vi /etc/passwd <--- You should be using /usr/ucb/vipw
: vi /etc/shadow
: mkdir userdir <--- You put homedirs in /etc? :)
: chmod 755 userdir


: chown username userdir
: chgrp usergroup userdir

Compared with:
useradd -m -d /home/userdir -c 'Luser' -s -g usergroup /usershell username

Frankly, yes.

: All that useradd etc., do is hide details that a sysadmin type is supposed to


: know anyway. And this is the simple stuff...

They're supposed to know it, but why mess with files like that manually?
I generally do not encourage screwing with passwd and shadow by hand.
ESPECIALLY the way you do it... all you need is someone changing their
password while you're messing around inside the file and you overwrite their
changes, or they overwrite yours...

--
| Brandon Hume aka "Hurricane" - hume at ug.cs.dal.ca & isisnet.com |
| "What was your username again? *Clickity-click*" |

Mike D. Kail

unread,
Oct 29, 1997, 3:00:00 AM10/29/97
to

On 28 Oct 1997 22:09:34 -0600, Sunil Kandwala <skha...@xnet.com> wrote:
>>
>>"James Beltran" <a-j...@microsoft.com> wrote:
>>>Is there a way to add users without using the ADMINTOOL utility?
>>>A command line interace alternative? I am behind a proxy server
>>>and cannot open a x session to open the admintool utility.
>
>Yes, edit /etc/passwd and /etc/shadow and add the new user, then create
>user dir as specified in /etc/passwd.

'useradd' is *much* easier, but if you do insist on editing the
/etc/passwd and /etc/shadow files you *must* do a 'pwconv' after you're
done editing

--
/*-------------------------------------------------------------*/
/* Mike D. Kail | voice: (619) 350-3524 */
/* Unix System Architect | fax: (619) 793-2950 */
/* FIRST VIRTUAL Holdings Inc. | e-mail: mdk...@fv.com */
/*-------------------------------------------------------------*/


Dr. Dolphin

unread,
Oct 29, 1997, 3:00:00 AM10/29/97
to James Beltran

James Beltran wrote:
>
> Is there a way to add users without using the ADMINTOOL utility?
> A command line interace alternative? I am behind a proxy server
> and cannot open a x session to open the admintool utility.
>
> Any help would be great.

Try a man on useradd.

DD

Frederic Goudal

unread,
Oct 29, 1997, 3:00:00 AM10/29/97
to

mdk...@fv.com (Mike D. Kail) writes:

>
> On 28 Oct 1997 22:09:34 -0600, Sunil Kandwala <skha...@xnet.com> wrote:
> >>

> >>"James Beltran" <a-j...@microsoft.com> wrote:
> >>>Is there a way to add users without using the ADMINTOOL utility?
> >>>A command line interace alternative? I am behind a proxy server
> >>>and cannot open a x session to open the admintool utility.
> >

> >Yes, edit /etc/passwd and /etc/shadow and add the new user, then create
> >user dir as specified in /etc/passwd.
>
> 'useradd' is *much* easier, but if you do insist on editing the
> /etc/passwd and /etc/shadow files you *must* do a 'pwconv' after you're
> done editing

Never done that and working fine. Just taking care shadow and passwd
file are in the same order. (Ok We use /etc/shadow for very little
account, the main ones are done with nis database from another file).

f.g.

Donald S. Bryant

unread,
Oct 29, 1997, 3:00:00 AM10/29/97
to Frederic Goudal

Harrison Picot

unread,
Oct 29, 1997, 3:00:00 AM10/29/97
to

Sunil Kandwala wrote:
: > >
:
: This is difficult to do ???
:
: vi /etc/passwd
: vi /etc/shadow
: mkdir userdir

: chmod 755 userdir
: chown username userdir
: chgrp usergroup userdir
:
: All that useradd etc., do is hide details that a sysadmin type is
supposed to
: know anyway. And this is the simple stuff...
:
: --Sunil

Maybe different tools are better at different times, and there
is a place for both. Steve Ward's example of a script that
read the enrollment lists, and then set up new accounts for
hundreds of new users, could not be done nearly so well without
useradd. The fact that sed or awk might do it does not
match the ease with which useradd would do it and with fewer
processes. If you'll be doing it many times, a nice tool is
handy.

Cheers,

Harrison

--
==================================================================
P. Harrison Picot II 703.925.7013
System Manager fax 703.708.7233
Aerospace and Defense 196 Van Buren St
Oracle Corporation Herndon, VA
=== "I'm confessin', I don't speak for anyone, I never took ===
=== a lesson, this stuff I do is just a matter of guessin'" txca

Sunil Kandwala

unread,
Oct 30, 1997, 3:00:00 AM10/30/97
to

In article <3457CD...@us.oracle.com>,


Agreed, if you have to add many users at once, then yes, absolutely
use a script, useradd etc. However, as you say, knowing both
is definately an advantage. Actually, I use scripts to monitor/sanity
check many things. Setting these things up w/cron and having
them mail you when things go belly up is quite useful.

cheers,
--Sunil

Ben Taylor

unread,
Oct 30, 1997, 3:00:00 AM10/30/97
to

James Beltran (a-j...@microsoft.com) wrote:
: Is there a way to add users without using the ADMINTOOL utility?
: A command line interace alternative? I am behind a proxy server
: and cannot open a x session to open the admintool utility.

If you have adminsuite loaded, you can do it with
/opt/SUNWadm/bin/admuseradd. Check the manpage for
details.

: James

Ben

Frederic Goudal

unread,
Oct 30, 1997, 3:00:00 AM10/30/97
to

hu...@ug.cs.dal.ca (BRANDON WILLIAM HUME) writes:
>
> They're supposed to know it, but why mess with files like that manually?
> I generally do not encourage screwing with passwd and shadow by hand.
> ESPECIALLY the way you do it... all you need is someone changing their
> password while you're messing around inside the file and you overwrite their
> changes, or they overwrite yours...

That's a real problem. Emacs just tells you the file has been
changed. So you don't overwrite it.
But is adduser secure about that ???

Anthony Mandic

unread,
Oct 31, 1997, 3:00:00 AM10/31/97
to

BRANDON WILLIAM HUME wrote:

>
> Sunil Kandwala (skha...@xnet.com) wrote:
> : This is difficult to do ???
>
> : vi /etc/passwd <--- You should be using /usr/ucb/vipw
> : vi /etc/shadow
> : mkdir userdir <--- You put homedirs in /etc? :)
> : chmod 755 userdir
> : chown username userdir
> : chgrp usergroup userdir

> They're supposed to know it, but why mess with files like that manually?


> I generally do not encourage screwing with passwd and shadow by hand.
> ESPECIALLY the way you do it... all you need is someone changing their
> password while you're messing around inside the file and you overwrite their
> changes, or they overwrite yours...

Your comments are incorrect. vipw creates a lock on /etc/passwd.
Passwords are stored in /etc/shadow now. Changing your password
has no effect on /etc/passwd. So the vipw command is next to
useless now (unless you have more than one sysadmin or someone
uses some of the other features of the password command, such
as changing one's shell). Oh, and Sunil wasn't in /etc. Note
the command 'vi /ETC/...', this suggests he was elsewhere,
like a home tree perhaps. Sunil's example can be further
refined as -

vi /etc/passwd /etc/shadow (might as well vi them both at once)


mkdir userdir
chmod 755 userdir

chown username:usergroup userdir

Only 4 commands. Trivial, I'd say.

[As an aside, when a former employer was looking for an extra
sysadmin, one test question they were asked was how do you
add new users. Everyone knew admintool, a few knew useradd
but only one knew the files that were touched and how to do
it manually. Guess which one was hired?]

-am

Anthony Mandic

unread,
Oct 31, 1997, 3:00:00 AM10/31/97
to

Frederic Goudal wrote:
>
> mdk...@fv.com (Mike D. Kail) writes:
>
> > 'useradd' is *much* easier, but if you do insist on editing the
> > /etc/passwd and /etc/shadow files you *must* do a 'pwconv' after you're
> > done editing
>
> Never done that and working fine. Just taking care shadow and passwd
> file are in the same order. (Ok We use /etc/shadow for very little
> account, the main ones are done with nis database from another file).

They don't have to be in the same order. And entries can be
missing from either with no ill effect (apart from the
obvious). Try it.

-am

BRANDON WILLIAM HUME

unread,
Oct 31, 1997, 3:00:00 AM10/31/97
to

Anthony Mandic (no_s...@agd.nsw.gov.au) wrote:
: Your comments are incorrect. vipw creates a lock on /etc/passwd.

Yes, /etc/ptmp. It also creates /etc/stmp, which other utilities don't
appear to check for when altering the shadow file. I'd call that a bug.

: but only one knew the files that were touched and how to do


: it manually. Guess which one was hired?]

I know *I* wouldn't want to hire someone who couldn't fix a damaged
passwd/shadow combo without /usr mounted. But we don't appear to be
distinguishing between the way you CAN do things, and the way you're
SUPPOSED to do things... so I'll concede...

Anthony Mandic

unread,
Nov 1, 1997, 3:00:00 AM11/1/97
to

BRANDON WILLIAM HUME wrote:
>
> I know *I* wouldn't want to hire someone who couldn't fix a damaged
> passwd/shadow combo without /usr mounted. But we don't appear to be
> distinguishing between the way you CAN do things, and the way you're
> SUPPOSED to do things... so I'll concede...

Well, so far we have 3 possible ways of doing it.
As to how you're supposed to do it, it would depend
on personal preferences.

Originally, there was only one way to do it. Some see
no reason to change. I suppose we can start a jihad
over this issue just for the fun of it. Or just revel
in the fact that admin is getting easier. Of course,
novices vi'ing password files raises two points -
do you let them learn or do you just want to prevent
them from possibly doing something incorrectly?

-am

Fil Krohnengold

unread,
Nov 3, 1997, 3:00:00 AM11/3/97
to

Frederic Goudal <gou...@info.enserb.u-bordeaux.fr> writes:

>
> "James Beltran" <a-j...@microsoft.com> writes:
>
> >
> > Is there a way to add users without using the ADMINTOOL utility?
> > A command line interace alternative? I am behind a proxy server
> > and cannot open a x session to open the admintool utility.
> >

> > Any help would be great.
>

> Edit the passwd file with you favorite editor.

Ooh - bad idea. /usr/ucb/vipw will use your favorite $EDITOR for you,
but it does proper file locking and if you screw up the format of a line
noticably enough (like say leaving something without a valid /etc/shells
shell), it won't let you make the changes.

As far as adding users, I've found that a shell script written around
useradd tends to work best with minimal overhead.

-fil
___________________________________________________________________________
Fil Krohnengold | UNIX Systems Admin, Interdepartmental Laboratories
f...@amnh.org | The American Museum of Natural History
212/769-5294 | CPW @ 79thSt / NY, New York / 10024


Paul Virgo.RMS.S411.x????

unread,
Nov 3, 1997, 3:00:00 AM11/3/97
to

Also, the 'useradd, usermod, userdel' family from SVR4 are pretty
good and easy, IMO. Just type the command, hit return, and it will
print out the app and appropriate keywords. You can easily use it
in shell scripts(I have)

virgo 'U.S.' bondz
--
Paul Virgo And now..a square dance call...
RMS Slapyerpardnerindaface
Goddard Space Flight Center Writebadchecksalloverdaplace
'It's not rocket science.... Flirtwithstrangersannoyyerspouse
it's ROCKETMAAAAAAAN!!!' Getadivorceandloseyerhouse,dosey-do...
--Dogbert

Kumar AN

unread,
Nov 7, 1997, 3:00:00 AM11/7/97
to

People keep mentioning useradd on Solaris, but it really doesn't work the
way its supposed to. For example you have to not only specify all the
options on the same command line, but the script for whatevere reasons
doesn't create the specified directory.

For example:

useradd -d /usr/home/alfa -s /usr/bin/csh alfa

should add the 'alfa' directory to the /usr/home directory, but it
doesn't and I have to go and add the directory by hand as well as a copy
of the dot files.

By comparison the 'adduser' script on OSF/1 runs real well

Arvind

Paul Virgo.RMS.S411.x???? (pvi...@vlsi.gsfc.nasa.gov) wrote:

--
------------------------------------------------------------------------------
The MiNd is like a PaRaChUtE.. it works when its OpEn
==============================================================================
af...@city.ac.uk http://www.city.ac.uk/~af281
==============================================================================

Tony Walton

unread,
Nov 7, 1997, 3:00:00 AM11/7/97
to

Kumar AN wrote:
>
> People keep mentioning useradd on Solaris, but it really doesn't work the
> way its supposed to. For example you have to not only specify all the
> options on the same command line, but the script for whatevere reasons
> doesn't create the specified directory.
>
> For example:
>
> useradd -d /usr/home/alfa -s /usr/bin/csh alfa
>
> should add the 'alfa' directory to the /usr/home directory, but it
> doesn't and I have to go and add the directory by hand as well as a copy
> of the dot files.


It's not for "whatever" reason - it's because you haven't told it to!

Check the manpage for useradd, which tells you "and creates the home
directory (-m option) for the user if requested. "

This

# useradd -d /usr/home/alfa -m -s /usr/bin/csh alfa

does the trick.


Tony

Speaking for myself, not for Sun

Dennis Piche

unread,
Nov 7, 1997, 3:00:00 AM11/7/97
to

Kumar AN wrote:
->
-> People keep mentioning useradd on Solaris, but it really doesn't work
the
-> way its supposed to. For example you have to not only specify all the
-> options on the same command line, but the script for whatevere
reasons
-> doesn't create the specified directory.
->
-> For example:
->
-> useradd -d /usr/home/alfa -s /usr/bin/csh alfa
->
-> should add the 'alfa' directory to the /usr/home directory, but it
-> doesn't and I have to go and add the directory by hand as well as a
copy
-> of the dot files.
->
-> By comparison the 'adduser' script on OSF/1 runs real well
->
-> Arvind

The -m option is used to create the directory. Check
the man pages.

--
Dennis Piche
Server and Network Services
FSIC - Ford Motor Company
(313) 621-7578 dpi...@ford.com SEIZE THE DAY!!
(I am speaking for myself - not Ford Motor Company)

Andrew Fitzgibbon

unread,
Nov 8, 1997, 3:00:00 AM11/8/97
to

Anthony Mandic <no_s...@agd.nsw.gov.au> writes:
>
> vi /etc/passwd /etc/shadow (might as well vi them both at once)
> mkdir userdir
> chmod 755 userdir
> chown username:usergroup userdir
>
> Only 4 commands. Trivial, I'd say.

Not quite....

vi /etc/passwd /etc/shadow (might as well vi them both at once)

Gousername:x:666:666:Luser:/home/userdir:/usershell<ESC>:wn
Gousername:::::::<ESC>ZZ


mkdir userdir
chmod 755 userdir
chown username:usergroup userdir

I think I'd take

useradd -m -d /home/userdir -c 'Luser' -s -g usergroup /usershell username

any day it was available....

A.

--
Andrew Fitzgibbon, a...@robots.ox.ac.uk
Oxford Information Engineering Research Group +44 01865 273127
<a href=http://www.robots.ox.ac.uk/~awf> Home Page </a>
"Never say there is no way"

Anthony Mandic

unread,
Nov 9, 1997, 3:00:00 AM11/9/97
to

Andrew Fitzgibbon wrote:

> Not quite....
>
> vi /etc/passwd /etc/shadow (might as well vi them both at once)
> Gousername:x:666:666:Luser:/home/userdir:/usershell<ESC>:wn

Hmmmm... you may also need to edit the groups file to
add the beast group.

> Gousername:::::::<ESC>ZZ
> mkdir userdir
> chmod 755 userdir
> chown username:usergroup userdir
>
> I think I'd take
>
> useradd -m -d /home/userdir -c 'Luser' -s -g usergroup /usershell username
>
> any day it was available....
>
> A.


-am

Chi-Chih Chen

unread,
Nov 10, 1997, 3:00:00 AM11/10/97
to
Hi,

There is another easy way to work around :

1) vi "/etc/auto_master"
2) comment out the line with directory /home
3) save it
4) run "admintool" in X windows
5) addusers and modify ....etc.

6) piece of cake


cc...@aleph0.clarku.edu

0 new messages