Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Modifying adduser script question.  Please Help!

Posted on 2003-03-17
Medium Priority
Last Modified: 2013-12-26
I am a Jr. UNIX admin. and I have been given the task of stream lining the process of adding users.  I need to modify our adduser scripts to:

a.     Add a user to multiple groups in one process.
b.     In a separate script, I need to add users to a group without a home dir. and add the same user to a separate group with a home dir.

The OS that I am currently running is HP-UX 11.00.  Any suggestions, tips, or resources would be much appreciated.


Question by:swillman

Accepted Solution

ellesd earned 1000 total points
ID: 8154300
You need to use the usermod script.  The -g option set the primary group, and the -G option specifies which additional groups the user can access.
To set the primary group of user to prigrp and allow user to access group1, group2, and group3:
  usermod -g prigrp -G group1,group2,group3 user

There is alot you can do with usermod.  Read the man page:
  man usermod
LVL 38

Expert Comment

ID: 8156149
You can just simply use "/usr/sbin/useradd" (HP-UX) to to the job. (You don't need to write a script!)

It does support multiple group. do a :
man useradd

to learn more details

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question