Written by Robert -
User your distro's package manager to install OpenSSH.
In this case I'm using Arch, so the command is
sudo pacman -S openssh.
Open the file
/etc/ssh/sshd_config using your favorite text editor. Add a line called
AllowUsers and add a username behind it. Also uncomment the
Port line. You can change the default port if you wish. This is especially useful when having a machine that has it's SSH port directly on the internet, like in the case of a VPS. If you use this, or don't trust the network where the machine is attached to, then make sure you take more security measures.
In my case I added these two lines:
Start the server:
First we start the SSH server:
sudo systemctl start sshd.socket
Now we can enable it so it starts automatically at boot:
sudo systemctl enable sshd.socket
Connecting to the server
From the client you can now use the following command to connect to the server:
If you have the same username on the server as you have on the client:
If you don't have the same username on the client as you have on the server, you need to specify this:
After accepting the fingerprint, you should now be connected: