Check user home in /etc/passwd
In this step, we'll explore how Linux stores information about users, specifically focusing on their home directories. The home directory is where a user's personal files and configurations are stored.
Linux keeps user account information in a file called /etc/passwd
. This file contains one line for each user account on the system. Let's view the contents of this file using the cat
command. cat
is a simple command that displays the content of a file.
Type the following command in your terminal and press Enter:
cat /etc/passwd
You will see a lot of output, with each line representing a user. Scroll through the output (you can use Shift + Page Up/Page Down or your mouse scroll wheel) until you find the line that starts with labex:
.
The line for the labex
user will look something like this:
labex:x:5000:5000:LabEx user,,,:/home/labex:/bin/zsh
Each field in this line is separated by a colon (:
). Here's a quick breakdown of the fields (from left to right):
- Username:
labex
- The name of the user.
- Password placeholder:
x
- This indicates that the password is encrypted and stored in /etc/shadow
(for security reasons).
- User ID (UID):
5000
- A unique number identifying the user.
- Group ID (GID):
5000
- The primary group ID for the user.
- Comment/GECOS field:
LabEx user,,,
- Contains general information about the user (like full name).
- Home Directory:
/home/labex
- This is the path to the user's home directory.
- Login Shell:
/bin/zsh
- The default shell (command interpreter) that starts when the user logs in.
For this step, the most important part is the sixth field, which shows the home directory for the labex
user is /home/labex
.
Understanding /etc/passwd
is fundamental to managing users and permissions in Linux.
Click Continue to proceed to the next step.