Enable SSH in Ubuntu: Step-by-Step Guide
To enable SSH remote login in Ubuntu, you can follow these steps:
- Install the OpenSSH server:
Run the following command in the terminal to install the OpenSSH server:
sudo apt update
sudo apt install openssh-server
- To start the SSH service:
Once the installation is complete, the SSH service will automatically start. You can check the status of the SSH service using the following command.
sudo systemctl status ssh
- Configure SSH service:
You can modify the configuration file of SSH service, located at /etc/ssh/sshd_config, as needed. For example, you can change the SSH port, allowed users, etc. - Firewall Configuration:
If a firewall (such as ufw) is enabled on your Ubuntu system, you need to make sure that the SSH service port is allowed. You can use the following command to allow the SSH port (default is 22) through the firewall:
sudo ufw allow ssh
- Remote connection:
You can now connect to a remote Ubuntu server using an SSH client. Open a terminal on another computer and use the following command to connect to the Ubuntu server (assuming the IP address is 192.168.0.1):
ssh username@192.168.0.1
The username is the name you use on the Ubuntu server.
In this way, you have successfully enabled SSH remote login in Ubuntu.