Sunday, November 17, 2013

Get user info and add user to group

The Linux command id print user and group information for the specified USERNAME, or (when USERNAME omitted) for the current user.
Linux command: id
The command groups print group memberships for each USERNAME or, if no USERNAME is specified, for the current process (which may differ if the groups database has changed).
Linux command: groups
Add user to group:
The example add user pi to group root
$ sudo adduser pi root
add user to group
You can also list users of a group use the command:
$ getent group <group>
$ grep ^<group> /etc/group
list users in group

No comments: