Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

Understanding the /etc/passwd File Format - DesignLinux

Aug 17 2020
designlinux 0 Comments
etc-passwd-file

The /etc/passwd is a text-based based database that stores the user account information. /etc/passwd file can be modified by root or users with sudo privileges and can be read by all the system users. It is owned by root and has 644 permissions and commonly used for user authentication.

It’s recommended to use the usermod command to modify the user account and useradd command to add new user account. Avoid the modification of the /etc/passwd file by hand.

/etc/passwd Format#

The /etc/passwd file contains one entry per line for each user. All the fields are separated by colon (:) symbol and total seven fields per line. Use the cat command to view the content of /etc/passwd file.

cat /etc/passwd
kunj:x:1000:1000:Kunj,,,:/home/kunj:/bin/bash
[--] - [--] [--] [-----] [--------] [--------]
|    |   |    |     |         |        |
|    |   |    |     |         |        +-> 7. Login shell
|    |   |    |     |         +----------> 6. Home directory
|    |   |    |     +--------------------> 5. GECOS
|    |   |    +--------------------------> 4. GID
|    |   +-------------------------------> 3. UID
|    +-----------------------------------> 2. Password
+----------------------------------------> 1. Username
  • Username – It’s a unique name used to login on system. The maximum length of the username is restricted to 32 characters.
  • Password – The value x indicates that the user’s password is encrypted and stored in /etc/shadow file.
  • UID – The system provide a unique id to each user which is used by system to identify the user.
  • GID – GID is user’s group identifier number, referring to the user’s primary group. When a user creates a file, the file’s group is set to this group. Typically, the name of the group is the same as the name of the user.
  • GECOS – This fields contains the additional information about the user such as full name, phone number, etc.
  • Home directory – The absolute path to the directory the user will be in when they log in.
  • Login shell – It’s absolute path to the user’s login shell. This is the shell that is started when the user logs into the system. Bash is the default login shell in most of Linux distribution.

Conclusion#

This article explained the information about the /etc/passwd file. The /etc/passwd file contains the information about the system users.

If you have any questions or feedback, feel free to leave a comment.

Related

Tags: terminal

How to Install CouchDB on Ubuntu 20.04

Prev Post

How to Install and Use PHP Composer on Debian 10

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 0
  • 1,132
  • 571,487

DesignLinux.com © All rights reserved

Go to mobile version