Secure Shell (SSH) is a protocol for securely accessing remote machine, it allows you to run command line and graphical programs, transfer files, and even create secure virtual private networks over the Internet.
Ubuntu does not provide the ssh service out-of-the-box. But you can easily enable it by installing the OpenSSH server package.
To enable SSH:
Search for and install the openssh-server package from Ubuntu Software Center. Or run command below in console if you’re on Ubuntu Server without GUI:
sudo apt-get install openssh-server
Once installed, the SSH service should be started automatically. If necessary, you can start (or stop, restart) the service manually via command:
sudo service ssh start
To edit settings:
To change the port, root login permission, you may edit the /etc/ssh/sshd_config file via:
sudo nano /etc/ssh/sshd_config
After you changed the configurations, press Ctrl+X followed by typing y and hitting enter to save the file.
Finally restart the SSH service to apply the changes:
sudo service ssh restart
Usage and Tips:
1. Normally, we can access remote machine through SSH via command:
ssh [email protected]
For the port that is not the default 22:
ssh [email protected] -p NUMBER
2. For desktop Ubuntu, root user need to be enabled first so that remote machines can SSH to it via root:
Run command below to set a password for root:
sudo passwd root
Then execute command to unlock the root account:
sudo passwd -u root
Edit the config file /etc/ssh/sshd_config, change the line
When done, restart the SSH service.
For more, read the community documents.