[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Commands Reference, Volume 4

newgrp Command


Changes a user's real group identification.


newgrp ] [ -l] [ Group ]


The newgrp command changes a user's real group identification. When you run the command, the system places you in a new shell and changes the name of your real group to the group specified with the Group parameter. By default, the newgrp command changes your real group to the group specified in the /etc/passwd file.

The newgrp command recognizes only group names, not group ID numbers. Your changes only last for the current session. You can only change your real group name to a group you are already a member of. If you are a root user, you can change your real group to any group regardless of whether you are a member of it or not.

Note: When you run the newgrp command, the system always replaces your shell with a new one. The command replaces your shell regardless of whether the command is successful or not. For this reason, the command does not return error codes.


- Changes the environment to the login environment of the new group.
-l Indicates the same value as the - flag.


Access Control: This command should be installed as a program in the trusted computing base (TCB). The command should be owned by the root user with the setuid (SUID) bit set.

Exit Status

If the newgrp command succeeds in creating a new shell execution environment, regardless if the group identification was changed successfully, the exit status will be that of the current shell. Otherwise, the following exit value is returned:

>0 An error occurred.


  1. To change the real group ID of the current shell session to admin , enter:
    newgrp admin
  2. To change the real group ID back to your original login group, enter:


                          Indicates the group file; contains group IDs.
                          Indicates the password file; contains user IDs.

Related Information

The login command, setgroups command.

[ Previous | Next | Contents | Glossary | Home | Search ]