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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

762 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