Konfigurasi Ssh server Debian 9

2 min read 1 hour ago
Published on Oct 06, 2025 This response is partially generated with the help of AI. It may contain inaccuracies.

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.

  1. Open your terminal.
  2. Update your package list by running:
    sudo apt update
    
  3. 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.

  1. Check the status of the SSH service by executing:
    sudo systemctl status ssh
    
  2. If the service isn’t running, start it using:
    sudo systemctl start ssh
    
  3. 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.

  1. Open the configuration file with a text editor:
    sudo nano /etc/ssh/sshd_config
    
  2. 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
      
  3. 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.

  1. 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.

  1. For UFW (Uncomplicated Firewall), run:
    sudo ufw allow ssh
    
  2. If you changed the port in Step 3, specify the port:
    sudo ufw allow 2222/tcp
    
  3. Enable the firewall if it’s not already active:
    sudo ufw enable
    
  4. 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!