User Management in Linux: A Comprehensive Guide

User Management in Linux: A Comprehensive Guide

Managing users in Linux is a fundamental aspect of system administration. Effective user management ensures that only authorized individuals can access the system and perform specific tasks, enhancing security and maintaining order in a multi-user environment. This tutorial will guide you through the essential concepts and commands for managing users in Linux.

Understanding User Types in Linux

  • Root User: The root user is the superuser with complete control over the system. It can perform any action, including modifying critical system files.
  • Regular Users: These are non-privileged users with limited permissions, typically used for day-to-day operations.
  • System Users: These accounts are used by system services and daemons. They usually do not have a home directory or shell access.

User Management Files

  • /etc/passwd: Contains user account information such as username, UID, GID, home directory, and default shell.
  • /etc/shadow: Stores password information, including password hashes and password expiration details.
  • /etc/group: Defines the groups to which users belong, along with GID and group members.

Creating a New User

To create a new user, use the useradd command:

sudo adduser username        

check/identify user

to check existence of user within a system

id username        


Deleting a User

To delete a user, use the userdel command:

sudo userdel username        

If you want to remove the user’s home directory along with the account:

sudo userdel -r username        

Change user in Terminal

Change user while staying at terminal:

su username        

Exit from self account:

exit        

Change password

change password for self account:

passwd        

Change password for another user:

sudo passwd username        

Sudo user managing

Add a user into sudo group:

sudo usermod -aG sudo username        

Remove a user from sudo group:

sudo gpasswd -d username sudo        



要查看或添加评论,请登录

Rafsan Anwar的更多文章

  • Top 10 Tips for Freshers Preparing a CV for Cybersecurity Jobs

    Top 10 Tips for Freshers Preparing a CV for Cybersecurity Jobs

    Creating a compelling CV is a critical step for freshers aspiring to break into the cybersecurity field. As…

  • Mastering File Compression in Linux: A Guide to zip, gzip, bzip2, and tar

    Mastering File Compression in Linux: A Guide to zip, gzip, bzip2, and tar

    In Linux, file compression is an essential skill for managing disk space and transferring large files efficiently. By…

    1 条评论
  • Advanced Package Tool (APT) in Linux

    Advanced Package Tool (APT) in Linux

    When it comes to managing software on a Linux system, the Advanced Package Tool (APT) is one of the most powerful and…

  • Permission Management in Linux File Systems

    Permission Management in Linux File Systems

    When working with Linux, understanding and managing file permissions is crucial for both system security and effective…

    1 条评论
  • Linux File and Folder Management

    Linux File and Folder Management

    Managing files and folders in Linux is a fundamental skill for both beginners and seasoned users. This article will…

    3 条评论
  • A Beginner's Guide to the Vi Editor in Linux

    A Beginner's Guide to the Vi Editor in Linux

    The Vi editor is a powerful and versatile text editor that comes pre-installed on almost all Unix-like operating…

  • Cyber Kill Chain

    Cyber Kill Chain

    In the ever-evolving landscape of cybersecurity, understanding and anticipating potential threats is crucial for…

  • Skills Require of an Ethical Hackers or Pentester

    Skills Require of an Ethical Hackers or Pentester

    In today's digital landscape, where cyber threats are becoming increasingly sophisticated, the role of ethical hackers…

  • The Next Generation Firewall

    The Next Generation Firewall

    In today's interconnected world, where cyber threats are growing in complexity and frequency, the need for robust…

  • Layers of OSI Model In Computer Networking

    Layers of OSI Model In Computer Networking

    The OSI model is composed of seven distinct layers, each with its specific functions and responsibilities. These layers…