About Linux FAQ

Browse More FAQs:

How To: UNIX Add A User To A Group

Posted by Vivek Gite [Last updated: June 16, 2008]

Q. How do I add a user to a group under Sun Solaris UNIX operating system from a shell prompt or command line?

A.. You can useadd command to administer a new user login on the UNIX system. Solaris UNIX / HP-UX UNIX uses /etc/passwd, /etc/shadow and /etc/group files to store user information.

Following information is compatible with the Solaris, AIX and HP-UX UNIX operating systems.

Add A New User To A Group

Add a new user called vivek to a group called vsftp, enter:
# useradd -G vsftp -d /data/home/v/vivek -m vivek
# passwd vivek

Where,

  • -G vsftp : Add vivek to secondary group called vsftp. This group must exists on the system.
  • -d /data/home/v/vivek : Path to the vivek's home directory
  • -m : Create the new user's home directory if it does not already exist.
  • vivek : Username / login nane

UNIX Add Existing User To A Secondary Group

Use usermod command to modify a user's login definition on the system including group membership. For, example add user vivek to sales group, enter:
# usermod -G sales vivek
Add user tom to sales but also keep his existing membership of ftpusers, enter:
# usermod -G ftpusers,sales tom

UNIX Add Existing User To A Primary Group

Add jerry to sales primary group and change its existing group membership:
# usermod -g sales jerry
For more information read following man pages:
$ man usermod
$ man useradd
$ man passwd

E-mail    Print    Can't find an answer to your question? Contact us

Related Other Helpful FAQs:

Discussion on This FAQ

  1. Mihir G joshi Says:

    Hello Vivek,

    I don’t want my private files to be displayed in the output of find command????

  2. Mihir G joshi Says:

    How do i hide my confidential files to be isolated from find output??

    I am using RHEL 5

    Mihir G joshi

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Tags: , , , , , , , , , , , , ,

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Powered by Open source software.