• WordPress
  • cPanel
  • Softaculous
  • KVM Virtualization
  • Vmware Virtualization
  • Proxmox
Sunday, June 15, 2025
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
No Result
View All Result
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux

How to configure and use SSH for secure remote access to Ubuntu

in Ubuntu
How to configure and use SSH for secure remote access to Ubuntu

Secure Shell (SSH) is a cryptographic network protocol used for secure remote access to a computer system. It is widely used for administering servers and other network devices remotely. In this blog, we will discuss how to configure and use SSH for secure remote access to Ubuntu.

Enabling SSH on Ubuntu

By default, SSH is not enabled on Ubuntu. To enable it, follow these steps:

  1. Open the terminal and update the system package list:
sudo apt-get update
  1. Install the SSH server:
sudo apt-get install openssh-server
  1. Once the installation is complete, start the SSH service:
sudo systemctl start ssh
  1. You can check the status of the SSH service using the following command:
sudo systemctl status ssh

Configuring SSH

After enabling SSH, you can configure it to meet your needs. Here are a few configuration options you may want to consider:

Changing the default SSH port

By default, SSH uses port 22. Changing the default port can help to prevent unauthorized access. To change the port, follow these steps:

  1. Open the SSH configuration file:
sudo nano /etc/ssh/sshd_config
  1. Find the line that specifies the port number (usually near the top of the file):
# Port 22
  1. Uncomment the line and change the port number to your desired value (e.g., 12345):
Port 12345
  1. Save the file and restart the SSH service:
sudo systemctl restart ssh

Restricting SSH access to specific users

You can restrict SSH access to specific users by editing the SSH configuration file:

  1. Open the SSH configuration file:
sudo nano /etc/ssh/sshd_config
  1. Find the line that specifies which users are allowed to access SSH (usually near the top of the file):
# AllowUsers user1 user2
  1. Uncomment the line and add the usernames of the users you want to allow:
AllowUsers user1 user2
  1. Save the file and restart the SSH service:
sudo systemctl restart ssh

Disabling password authentication

To further enhance security, you can disable password authentication and use SSH keys instead. Here’s how:

  1. Open the SSH configuration file:
sudo nano /etc/ssh/sshd_config
  1. Find the line that specifies whether password authentication is allowed:
# PasswordAuthentication yes
  1. Uncomment the line and change “yes” to “no”:
PasswordAuthentication no
  1. Save the file and restart the SSH service:
sudo systemctl restart ssh

Using SSH

To use SSH to connect to a remote Ubuntu server, follow these steps:

  1. Open a terminal on your local machine.
  2. Type the following command, replacing “username” and “server_ip” with the appropriate values:
ssh username@server_ip
  1. If this is your first time connecting to the server, you will be prompted to accept the SSH key fingerprint. Type “yes” to continue.
  2. If password authentication is enabled, you will be prompted to enter your password. If you have disabled password authentication, you will need to use an SSH key instead.
  3. Once you are logged in, you can use the terminal to run commands on the remote server.

Conclusion

SSH is a powerful tool for secure remote access to Ubuntu. By following the steps outlined in this blog, you can enable, configure, and use SSH to connect to your Ubuntu server with confidence. Remember to always follow the best.

ShareTweet
Previous Post

How to set up a file server on Ubuntu using Samba or NFS

Next Post

How to set up a mail server on Ubuntu with Postfix and Dovecot

Related Posts

How to Install Plesk on Ubuntu Server

How to Install Plesk on Ubuntu Server

How to Install cPanel on Ubuntu Server

How to Install cPanel on Ubuntu Server

Top 10 Best Linux OS for Web Hosting

Top 10 Best Linux OS for Web Hosting

Leave a Reply Cancel reply

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

Golden Host VPS
  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.

  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.