Table of Contents
- Switch Users and sudo Access
- Monitor Logged-In Users
- Communicate with Logged-In Users
- Linux Account Authentication
- Account Types and Directory Services
- Useful System Utility Commands
- Processes and Jobs
- Managing Services and Jobs
Description
Learn how to manage users, monitor sessions, use sudo, and handle Linux processes and services with practical command-line examples.
This guide covers a wide range of foundational topics in Linux system administration, including user switching, sudo access, monitoring user sessions, account authentication, and managing services and processes.
Switch Users and sudo Access
Linux allows you to switch users or run administrative commands without fully logging into another account.
Switch User:
sudo su - username
Temporarily switch to another user’s shell. Useful when performing actions as another user.
Run as Superuser
sudo command
Execute one command with superuser privileges. Safer than logging in as root.
sudo command
visudo
This safely opens the */etc/sudoers * file for editing, which controls sudo permissions. Avoid editing this file directly.
alice ALL=(ALL) NOPASSWD: ALL
This allows the user alice to run any command as sudo without being prompted for a password.
Monitor Logged-In Users
Linux provides tools to view user activity and login history, which is helpful for security and troubleshooting.
who
Shows who is currently logged in and from where.
last
Displays login history using data from /var/log/wtmp.
w
Gives detailed information about current users and their active processes.
id
Displays UID, GID, and group memberships of the specified user.
id admin-1
Communicate with Logged-In Users
You can send messages to users on the system using these commands.
users
Prints the usernames of users currently logged in.
wall
Broadcasts a message to all terminal users.
`wall system will be updated on Monday 25th at 2pm
write
Sends a direct message to another user’s terminal. Type your message and press** Ctrl+D **to send.
write admin-1
I logged on to admin-1
user on a different terminal and you can see the message was sent to the user successfully.
Linux Account Authentication
Linux authentication verifies a user’s identity. Accounts can be stored locally or managed centrally through a directory service.
- Local accounts: Defined in /etc/passwd, managed on the local machine.
- Domain accounts: Managed through centralized systems like LDAP or Active Directory.
Account Types and Directory Services
Different systems are used to manage identities and authentication across networks.
Directory Service | Description |
---|---|
Active Directory | Microsoft’s centralized directory system |
IDM | Red Hat’s Identity Manager (based on FreeIPA) |
WinBIND | Allows Linux systems to authenticate against AD via Samba |
OpenLDAP | Open-source implementation of LDAP |
IBM Directory | IBM’s enterprise-grade directory service |
JumpCloud | Cloud-based directory platform |
LDAP | Lightweight Directory Access Protocol, used for querying and modifying directory services |
Useful System Utility Commands
Basic system utilities that help admins quickly gather information about the system
Command | Description |
---|---|
date | Displays current date and time |
uptime | Shows how long the system has been running |
hostname | Displays or sets the system’s hostname |
uname | Displays kernel and system information |
which | Finds the location of a command |
cal | Displays a calendar |
bc | Basic calculator |
Processes and Jobs
Processes are instances of running programs. Jobs may refer to background or scheduled tasks.
- Applications: GUI or command-line programs
- Scripts: Shell or other language scripts
- Processes: Running instances of programs
- Daemons: Background services (e.g., sshd)
- Threads: Lightweight processes running within a parent process
- Jobs: Commands or tasks sent to the background or scheduled
Managing Services and Jobs
Manage services and processes using the following tool.
systemctl / service
sudo systemctl status crond
Check service status (systemd and SysV init compatible).
sudo service nginx status
- will show the same result
ps
Shows a snapshot of all running processes. There are several options you can with ps
.
top
Real-time view of system performance and resource usage.
kill
Terminates a process by PID.
kill process ID
crontab -e
Schedules recurring tasks (cron jobs).
Breakdown
- 0 → Minute (0th minute)
- 17 → Hour (5 PM, in 24-hour format)
- * * * - Every day of the month, every month, every day of the week
- /home/student/backup.sh - Full path to the script or command to execute
These commands and concepts are essential for effective Linux administration. Whether you're building automation with Ansible, managing user accounts, or monitoring system processes, mastering these tools will greatly increase your confidence and efficiency.
Top comments (0)