Step-by-Step Guide: Enabling SSH on Ubuntu

Step-by-Step Guide: Enabling SSH on Ubuntu

Step-by-Step Guide: Enabling SSH on Ubuntu

This guide will walk you through the process of enabling SSH on an Ubuntu system. Follow each step carefully to ensure SSH is set up correctly.

Step 1: Install OpenSSH Server

  1. Open the terminal on your Ubuntu system.
  2. Update the package list:
    sudo apt-get update
  3. Install the OpenSSH server:
    sudo apt-get install -y openssh-server
  4. Confirm the installation:
    sudo service ssh status

Step 2: Configure SSH Server

  1. Open the SSH configuration file:
    sudo nano /etc/ssh/sshd_config
  2. Modify the following lines to enable password authentication:
    PasswordAuthentication yes
    PermitRootLogin yes
    UsePAM yes
            
  3. Save and exit the file (press CTRL + X, then Y, and Enter).

Step 3: Restart SSH Service

  1. Restart the SSH service to apply the changes:
    sudo service ssh restart

Step 4: Allow SSH Through the Firewall

  1. Allow SSH traffic through the firewall:
    sudo ufw allow 22
  2. If UFW is disabled, enable it:
    sudo ufw enable
  3. Check the firewall status:
    sudo ufw status

Step 5: Test SSH Access

  1. From another machine, use the SSH command to connect:
    ssh user@server_ip

    Replace user with your username and server_ip with your Ubuntu server’s IP address.

Step 6: Set Up Key-Based Authentication (Optional)

  1. Generate SSH keys on the client machine:
    ssh-keygen -t rsa -b 2048
  2. Copy the public key to the Ubuntu server:
    ssh-copy-id user@server_ip
  3. Once the key is copied, disable password-based login for security:
    PasswordAuthentication no
            
  4. Restart the SSH service to apply changes:
    sudo service ssh restart

Final Verification

After setup, test SSH access again from another machine:

ssh user@server_ip

If you’ve set up key-based authentication, you should be able to log in without a password.

Video Guide Outline

  1. Introduction: Introduce what SSH is and why it’s useful.
  2. Install OpenSSH Server: Show commands for updating and installing OpenSSH.
  3. Configure SSH Server: Edit and modify the SSH configuration file.
  4. Restart SSH and Firewall Settings: Restart SSH and allow SSH in the firewall.
  5. Testing and Key-Based Authentication: Demonstrate SSH connection and key-based login setup.
  6. Conclusion: Summarize what was covered and suggest further security steps.

Note:

For better security, always disable root login and password-based authentication in production environments after setting up key-based authentication.

Abishek Lakandri Avatar

Leave a Reply

Your email address will not be published. Required fields are marked *

© 2023- All Rights Reserved by Abishek Lakandri