Linux Administration: How to Manage Users, Permissions, and Services

As a Linux system administrator, managing users, permissions, and services is an essential part of your role. Linux is a multi-user operating system that provides administrators with several tools to manage system users and groups, control permissions and access, and run services.

In this article, we will discuss Linux administration, including how to manage users, permissions, and services.

Linux User Management

Linux is a multi-user operating system that allows system administrators to create different user accounts with varying levels of privileges. The adduser and useradd commands are the most commonly used commands for creating new users.

To add a new user, use the following command:

sudo adduser <username>

To add a user to a group, use the following command:

sudo adduser <username> <group>

To delete a user, use the following command:

sudo userdel <username>

Permissions and Access Control

Linux file permissions control who can access files and directories and what can be done with them. The chmod command is used to change the permissions of files and directories.

To change the permissions of a file or directory, use the following command:

chmod <permission> <file/directory>

The chown command is used to change the ownership of a file or directory.

To change the ownership of a file or directory, use the following command:

sudo chown <user> <file/directory>

Managing Services

Linux services can be managed using the systemctl command. To start, stop or restart a service, use the following commands:

To start a service:

sudo systemctl start <service>

To stop a service:

sudo systemctl stop <service>

To restart a service:

sudo systemctl restart <service>

To enable a service to start automatically at boot:

sudo systemctl enable <service>

To disable a service from starting automatically at boot:

sudo systemctl disable <service>

Managing Linux Firewall

Firewall is one of the most essential parts of Linux security. Linux administrators can configure the firewall using the iptables command.

To list the current firewall rules:

sudo iptables -L

To allow a specific port through the firewall:

sudo iptables -A INPUT -p <protocol> --dport <port> -j ACCEPT

To deny a specific port through the firewall:

sudo iptables -A INPUT -p <protocol> --dport <port> -j DROP

Summary

Linux Administration involves user management, permissions and access control, service management, and firewall configuration. Administrators can create or delete new users, manage file permissions and access control with chmod and chown commands, start, stop or restart system services using systemctl command, and configure the firewall using iptables command.