How to install SSH in your Ubuntu Server

in

Installing SSH on an Ubuntu Server is a straightforward process. Here's a step-by-step guide to do it:

1.Update Package Lists: It's a good practice to update the package lists to ensure you're installing the latest version of SSH:

sudo apt update

2.Install SSH Server Package: Ubuntu uses OpenSSH as its default SSH implementation. You can install the SSH server package by running:

sudo apt install openssh-server

3.Edit the SSH Configuration File: Use your preferred text editor to modify the SSH daemon configuration file. For example, you can use nano:

sudo nano /etc/ssh/sshd_config

4.Customize SSH Settings: Inside the configuration file, you'll find various options that you can adjust based on your needs. Here are some common settings you might want to consider:


Port: By default, SSH runs on port 22.

You can change this to a different port number for security reasons, especially if you're experiencing frequent login attempts from unauthorized sources:

Port 2222

PermitRootLogin: Change to yes your can access the root of your server

PermitRootLogin yes

PasswordAuthentication: Enabling password authentication allows users to log in using a password.

PasswordAuthentication yes

5.Restart SSH Service: After modifying the SSH configuration, you need to restart the SSH service for the changes to take effect:

sudo systemctl restart ssh

6.Verify Configuration Changes: You can double-check that your SSH configuration changes have been applied correctly by examining the SSH daemon's status:

sudo systemctl status ssh

7.Adjust Firewall Settings: If you have a firewall configured on your Ubuntu Server (like UFW), you may need to allow SSH traffic. By default, SSH uses port 22. You can allow SSH traffic by running:

sudo ufw allow ssh

8.Access Your Server via SSH: Now that SSH is installed and running, you can access your Ubuntu Server remotely from another computer using an SSH client. Use the following command, replacing username with your username and hostname with your server's IP address or domain name:

ssh username@hostname












No comments:

Post a Comment

Contact me

Get in Touch

Name
Suriya Ravichandran
Address
Chennai,Tamilnadu
Email
rsuriya119@gmail.com
Message me