2. Remote Server SSH and Network Configuration Debian 10 || OpenSSH Server Linux Debian

3 min read 6 months ago
Published on Aug 20, 2024 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

This tutorial provides a comprehensive guide on configuring a remote server using SSH on Debian 10. By following these steps, you'll learn how to set up OpenSSH Server for remote access and manage network configurations effectively. This process is essential for system administrators and anyone looking to manage Linux servers remotely.

Step 1: Install Debian 10

  • Download the Debian 10 ISO from the official site:
  • Create a bootable USB drive or DVD using the downloaded ISO.
  • Install Debian 10 on your server or virtual machine by following the on-screen instructions.

Step 2: Update System Packages

  • Open a terminal on your newly installed Debian system.
  • Run the following commands to update all package listings and installed packages:
    sudo apt update
    sudo apt upgrade
    

Step 3: Install OpenSSH Server

  • Install the OpenSSH server package by executing:
    sudo apt install openssh-server
    
  • Ensure the SSH service is running:
    sudo systemctl start ssh
    
  • Enable the SSH service to start on boot:
    sudo systemctl enable ssh
    

Step 4: Configure SSH Settings

  • Edit the SSH configuration file to enhance security:
    sudo nano /etc/ssh/sshd_config
    
    • Consider changing the default port (22) for security:
      Port 2222  # Change to your preferred port
      
    • Disable root login by setting:
      PermitRootLogin no
      
  • Save and exit the editor (Ctrl + X, then Y, and Enter).
  • Restart the SSH service to apply changes:
    sudo systemctl restart ssh
    

Step 5: Adjust Firewall Settings

  • If you have a firewall enabled, ensure you allow SSH traffic:
    sudo ufw allow 2222/tcp  # Use the port you set in sshd_config
    sudo ufw enable          # Enable UFW if it is not already enabled
    sudo ufw status          # Check the status to confirm the rules
    

Step 6: Connect to the Remote Server

  • Use an SSH client from another machine to connect:
    ssh username@your_server_ip -p 2222
    
    • Replace username with your actual username and your_server_ip with the server's IP address.

Step 7: Network Configuration

  • Configure your network settings if needed. Edit the network interfaces file:
    sudo nano /etc/network/interfaces
    
    • Example configuration for a static IP:
      auto eth0
      iface eth0 inet static
          address 192.168.1.100
          netmask 255.255.255.0
          gateway 192.168.1.1
      
  • Save changes and restart the networking service:
    sudo systemctl restart networking
    

Conclusion

You've successfully set up a remote server with OpenSSH on Debian 10 and configured network settings. You can now access your server securely from any location. Next steps may include setting up additional security measures, such as key-based authentication, and exploring other server management tools.