Linux User Management

Linux user management with Ubuntu

In Ubuntu the root user is disabled for safety.
Management tasks that require root access can be completed by using the sudo command by an user who is in the admin group.
The user created during the installtion process is automatically added to the admin group.

Creating and deleting groups

To create a group:

sudo addgroup groupname

To delete a group:

sudo delgroup groupname

To add a user to a group:

sudo adduser username groupname

User profiles

By default, all new home directories are accessible by everyone. You can enforce non-default access rights to new home directories by editing /etc/adduser.conf
The contents of this directory are modelled after the
contents of /etc/skel.
Change “DIRMODE=0755”to “DIRMODE=0750”

Password policy

You can enforce strong user passwords by editing the password policy file /etc/pam.d/common-password.
For example, to enforce a password with minimum 6 characters, edit the password line to look like this:

password required nullok obscure min=6 max=8 md5

Password expiration

To see the password expiry value for a user, use the "chage" command:

sudo chage -l username

To make changes:

sudo chage username

The chage tool is for changing password expiration date.