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
- Open the terminal on your Ubuntu system.
- Update the package list:
sudo apt-get update
- Install the OpenSSH server:
sudo apt-get install -y openssh-server
- Confirm the installation:
sudo service ssh status
Step 2: Configure SSH Server
- Open the SSH configuration file:
sudo nano /etc/ssh/sshd_config
- Modify the following lines to enable password authentication:
PasswordAuthentication yes PermitRootLogin yes UsePAM yes
- Save and exit the file (press CTRL + X, then Y, and Enter).
Step 3: Restart SSH Service
- Restart the SSH service to apply the changes:
sudo service ssh restart
Step 4: Allow SSH Through the Firewall
- Allow SSH traffic through the firewall:
sudo ufw allow 22
- If UFW is disabled, enable it:
sudo ufw enable
- Check the firewall status:
sudo ufw status
Step 5: Test SSH Access
- 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)
- Generate SSH keys on the client machine:
ssh-keygen -t rsa -b 2048
- Copy the public key to the Ubuntu server:
ssh-copy-id user@server_ip
- Once the key is copied, disable password-based login for security:
PasswordAuthentication no
- 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
- Introduction: Introduce what SSH is and why it’s useful.
- Install OpenSSH Server: Show commands for updating and installing OpenSSH.
- Configure SSH Server: Edit and modify the SSH configuration file.
- Restart SSH and Firewall Settings: Restart SSH and allow SSH in the firewall.
- Testing and Key-Based Authentication: Demonstrate SSH connection and key-based login setup.
- 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.
Leave a Reply