Konfigurasi Ssh server Debian 9
Table of Contents
Introduction
This tutorial will guide you through the process of configuring an SSH server on Debian 9. SSH (Secure Shell) is a protocol used to securely access and manage devices over a network. Setting up an SSH server is essential for remote server management and secure communication.
Step 1: Install SSH Server
To get started, you need to install the OpenSSH server package.
- Open your terminal.
- Update your package list by running:
sudo apt update
- Install the OpenSSH server with the command:
sudo apt install openssh-server
Step 2: Check SSH Service Status
After installation, verify that the SSH service is running correctly.
- Check the status of the SSH service by executing:
sudo systemctl status ssh
- If the service isn’t running, start it using:
sudo systemctl start ssh
- To enable SSH to start on boot, run:
sudo systemctl enable ssh
Step 3: Configure SSH Settings
You may want to adjust the default SSH configuration for security and usability.
- Open the configuration file with a text editor:
sudo nano /etc/ssh/sshd_config
- Consider the following changes:
- Change the default port (optional for security):
Port 2222
- Disable root login:
PermitRootLogin no
- Allow only specific users (optional):
AllowUsers your_username
- Change the default port (optional for security):
- Save and exit the editor (Ctrl + X, then Y, then Enter).
Step 4: Restart SSH Service
After making changes to the configuration file, restart the SSH service to apply the new settings.
- Execute the following command:
sudo systemctl restart ssh
Step 5: Allow SSH Through Firewall
If you have a firewall enabled, you need to allow SSH traffic.
- For UFW (Uncomplicated Firewall), run:
sudo ufw allow ssh
- If you changed the port in Step 3, specify the port:
sudo ufw allow 2222/tcp
- Enable the firewall if it’s not already active:
sudo ufw enable
- Check the firewall status with:
sudo ufw status
Conclusion
You have successfully configured an SSH server on Debian 9. Key actions included installing the OpenSSH server, checking its status, customizing settings for enhanced security, and ensuring firewall rules allow SSH traffic.
Next steps could involve testing your SSH connection from a remote machine or exploring additional security measures like setting up SSH keys for authentication. Happy remote managing!