Linux User Management
Linux operating system have users to operate applications, services and other stuff. Multiple users can be interact with Linux and we call it multi-user. It may be ridiculous but long time ago operating systems was single user. Which means to work on a system other users should sign out. Now in our era we have no restrictions like that.
There is a default user named
root almost all Linux distributions. There are other users coming by default but these users are generally service users. Service user is used by the application those run on the system and generally do not used by real human users. Adding user can be done with different way but most used one is;
$ useradd poftut
Adding user means adding user name to the user database, creating home directory under /home and other configuration files like .bash. Keep in mind that to add user Admin privileges are required which practically means we need to be root user to add new user.
Now we have added our user but want to get users in the current user database.
uid=(root) gid=(root) groups=(root)
- uid user id which identifies current user in the system
- gid group id which identifies current users group in the system
- groups lists groups where current user is a member
But we want to get a specific user information.
$ id -u poftut
Like adding user in to the system deleting user is a task for a system administrator too. Deleting user is simple as adding user.
$ userdel poftut
If we look into the user database we cannot see the user
# cat /etc/passwd
But wait a minute if we look into the
/home we can see that poftut’s home directory exist. To delete a user with his home directory use
$ userdel -r poftut