To set up an SSH server on Ubuntu, follow these steps:
- Install OpenSSH server: Open a terminal window and type the following command:sudo apt-get install openssh-server
This will install the OpenSSH server on your Ubuntu machine.
- Configure the SSH server: Once the installation is complete, you need to configure the SSH server. Open the sshd_config file located at /etc/ssh/sshd_config with a text editor:sudo nano /etc/ssh/sshd_config
In this file, you can configure various settings, such as the port number, authentication methods, and allowed users. Make the necessary changes and save the file.
- Restart the SSH server: After making changes to the sshd_config file, you need to restart the SSH server to apply the changes. Type the following command:sudo systemctl restart ssh
This will restart the SSH server and apply the new configuration.
- Connect to the SSH server: Once the SSH server is up and running, you can connect to it using an SSH client. If you are connecting from a remote machine, you will need to know the IP address of your Ubuntu machine. Open a terminal window on your remote machine and type the following command:ssh username@ip_address
Replace "username" with your Ubuntu username and "ip_address" with the IP address of your Ubuntu machine. You will be prompted for your Ubuntu password.
That's it! You have now set up an SSH server on your Ubuntu machine and can connect to it from a remote machine.