Linux Service Guides
Linux Service Guides
This guide provides detailed configuration and usage for three common Linux services. Click the tabs below to view the different service guides.
SSH Service Guide
SSH (Secure Shell) is a secure protocol for remote login and other network services. It provides an encrypted communication channel.
Note
SSH has become the standard tool for Linux/Unix system administration, replacing insecure protocols such as Telnet and rlogin. Beyond remote login, it also supports file transfer, port forwarding and more.
Installing SSH
On most Linux distributions you can install the SSH service with the package manager.
On Debian/Ubuntu
sudo apt update
sudo apt install openssh-serverOn CentOS/RHEL
sudo yum install openssh-serverConfiguring SSH
The SSH configuration file is located at /etc/ssh/sshd_config.
Sample configuration
# Port number
Port 22
# Listen addresses
ListenAddress 0.0.0.0
ListenAddress ::
# Allowed users
AllowUsers user1 user2
# Disable password authentication, key authentication only
PasswordAuthentication no
PubkeyAuthentication yes
# Enable X11 forwarding
X11Forwarding yes
# Log level
LogLevel INFOExplanation
Port: the port the SSH service listens on.ListenAddress: the addresses the SSH service listens on.AllowUsers: the list of users allowed to log in.PasswordAuthentication: whether password authentication is allowed.PubkeyAuthentication: whether public key authentication is allowed.X11Forwarding: whether X11 forwarding is enabled.LogLevel: the log level.
Starting and Managing the SSH Service
sudo systemctl start ssh # start the service
sudo systemctl enable ssh # enable on boot
sudo systemctl status ssh # check service statusUsing SSH
Connect to a remote server:
ssh username@hostnameGenerate an SSH key pair:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"Copy the public key to the remote server:
ssh-copy-id username@hostname@tab Samba
Samba Service Guide
Samba implements the SMB/CIFS protocol, enabling file and printer sharing between Linux and Windows systems.
Installing Samba
On Debian/Ubuntu
sudo apt update
sudo apt install sambaOn CentOS/RHEL
sudo yum install sambaConfiguring Samba
Edit the configuration file:
sudo nano /etc/samba/smb.confAdd a shared directory:
[share]
comment = Shared Directory
path = /srv/share
browseable = yes
read only = no
valid users = user1Set the Samba password for the user:
sudo smbpasswd -a user1Starting and Managing Samba
sudo systemctl start smbd
sudo systemctl enable smbd
sudo systemctl status smbdAccessing from Windows
Open the file explorer and visit \\<server-ip>\share, then log in with the Samba username and password.
:::
