Linux > More on USER ID, Password, and Group management

In order login into Linux system (over ssh or other services ) you need a username and password.
Username and password stored in /etc/passwd and /etc/shadow file respectively. When you supplies password, it encrypts and compare with password stored in /etc/shadow, which is also in, encrypted format (it was stored when you or system administrator registers/updates it). If both are equal, you are in. Once logged in, you become the number to Linux kernel. You can obtain your user id and other information using id command:

$ id
uid=1002(vivek) gid=1002(vivek) groups=1002(vivek), 0(wheel)

=> Username = vivek
=> User numeric id (uid) = 1002

Numbers are uses to represent users and groups in Linux kernel because:
1) Simplified user and group management
2) Security management easy
3) Your UID applied to all files you create

It is always good idea to use the UID more than 1000 for all users for security reason.

Zero UID

The UID number 0 is special and used by the root user. The zero (0) UID enjoys the unrestricted/unlimited access to Linux system. Note that 0 UID assigned to name root; if you wish you can change this (poorly written program may fail) and assign different name.

Similarly, you have group id (GID). It is use by Linux to refer group names. Single user can be member of multiple groups. This result into very good flexibility for access the system and the sharing files. Many UNIX system uses wheel group as power user group. Like the UID value, zero GID value zero enjoys the unrestricted/unlimited access to Linux system.

Some time Linux and other UNIX like (FreeBSD, Solaris etc) uses EUID, RUID, and SUID concept.

The Effective User ID (EUID)

It is use to determine what level of access the current process has. When EUID is zero then the process has unrestricted/unlimited access. Following commands can be used to print Effective User ID under Linux:
$ whoami
$ id -un

The Real User ID (RUID):

It is use to identify who you actually are. Once it is setup by system (usually login program) it cannot be change till your session terminates. You cannot change your RUID. Only root (or person having zero UID) can change the RUID. Use the command id as follows to obtain Real user ID:
$ id –ru

The Saved User ID (SUID):

When new process / executable file such as passwd, started the effective user id that is in force at the time is copied to the saved user id. Because of this feature, you are able to update your own password stored in /etc/shadow file. Off course, executable file must have set-user-id bit on in order to setuid (system call). Before process ending itself it switches back to SUID.

In short,

  • RUID : Identify the real user, normal user cannot change it.
  • EUID : Decides access level, normal user can change it.
  • SUID : Saves the EUID, normal user cannot change it.
  • Real Group ID : Identify the real group
  • Effective Group ID and Supplementary group ID : Decides access level

Note that access level means kernel can determine whether you have access to devices, files etc.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 19 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
19 comments… add one
  • devil Jan 31, 2007 @ 21:09

    hi ,

    I have created a user in the system other then root and I want to give it all the properties of can I do it.??????????????

  • 🐧 nixCraft Feb 1, 2007 @ 21:58


    Use as follows in sudo file
    username ALL=(ALL) ALL

  • vipul kania Mar 23, 2007 @ 7:24

    i forget my fedora password can u tell me how i can find it in proper manner

    • Arabinda Apr 11, 2015 @ 5:20

      You have to reset the password in cli mode

  • hong dao Sep 20, 2007 @ 7:51

    i forget my user name and password, please help me to log-in my computer

    • sumit chatterjee Sep 16, 2010 @ 23:02

      off-course, u may inter your computer,
      for this, u have to take some step.
      1. at first ,before starting booting Linux flavor just press up arrow key
      2.for going interactive mode press e,then 1 and press b
      3.after this u will be on interactive mode then u may change your password,
      #Passwd root
      then ask enter password….
      when u got successfully change your password
      #Init 5 after that you are able to access system.

  • franklindoss Sep 10, 2008 @ 10:03

    redht linx has permi cmd chmod then why need suid and sgid

  • salah Jan 1, 2009 @ 14:22

    hlo evrybody
    i wanaa ask u about user &group management
    if any 1 know how can i manage them
    please send it to me at ((
    thank u

  • Kiran Jun 14, 2010 @ 10:21

    Any one can explain me abt set UID GID and sticky and hw it works…the permissions i know

  • Panos Feb 9, 2012 @ 16:03

    I have mistakenly create some zero-long-named groups in my Linux based Nas. How can I access through Windows and delete them?

  • Manjunath Mar 11, 2012 @ 6:26

    can you please explain about SUID & SGID including all the command , Bcoz am trying to do from so many days am not able to give permission so please help me out of this

  • sekar Sep 28, 2012 @ 7:18

    If we want to create User ID in System, How can we assign the same user ID to different User.??????

    please answer me

    thanks in advance

  • sekar Sep 28, 2012 @ 7:19

    If I am not able to boot my Linux system? What are the Steps to resolve it.

    thanks in advance…

  • rohit badgujar Mar 13, 2013 @ 10:45

    very good

  • Reetesh Chauhan Apr 6, 2014 @ 20:34

    Hello! EveryOne,
    I have also few queries. Please find it below-
    1. Can we change uid of root user?
    2. Can we set a normal user’s uid as 0?
    3. If anyone trying to access my computer, How can I get log-in information of my system on my e-mail or mobile?

    Thanks in advance…

    • WooHoo Sep 21, 2014 @ 17:18

      1. Yes, but why? usermod -ou root
      2. Yes, but why? usermod -ou 0
      3. That will depend on how you have your box set up. Someone could always disconnect your system while using it. A more certain manner though would be to have the time/date, etc spooled for later sending or reading once your home. Do you mean trying to access it remotely or from the console.

  • ustad kasim Nov 15, 2014 @ 18:42

    Hi I m Kasim
    whenever u create a user or group os assign default user I’d ,group I’d , and others
    you can change the user I’d nd group I’d but u cant change the root user I’d
    remember root userid is 0 and others user start 1 to 499
    limit is 65535

  • Richard Mar 23, 2015 @ 13:32

    What is the Linux command for this?
    In windowsDOS I enter “Net user ecmadmin /DOMAIN” it returns the following
    The request will be processed at a domain controller for domain
    User name ecmadmin
    Full name ecmadmin
    Comments O: Moore, John (N57498) B: Galper, Michael (C44610)

  • Richard Mar 23, 2015 @ 13:33

    What is the Linux command for this?
    In windowsDOS I enter “Net user ecmadmin /DOMAIN” it returns the following
    The request will be processed at a domain controller for domain
    User name ecmadmin
    Full name ecmadmin
    Comments O: Moore, John (N57498) B: Galper, Michael (C44610)

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum