Administer Ubuntu Server Noble Numbat 24.04LTS remotely via SSH
Historically, the best way to administer a server remotely would have been to install Putty on your client machine and then create a Putty session to access it. The newer versions of Windows effectively have a Putty client built in so you no longer need to install Putty to be able to access and administer your server remotely.
You still need OpenSSH Server to be installed on your server tho. So, if you’ve not installed OpenSSH Server already, then you can do so by issuing the following two commands from the command line on your server:
sudo apt update
sudo apt install openssh-server
or as previously mentioned, you can issue both commands in one as follows:
sudo apt update;sudo apt install openssh-server
Now to tackle the client side. Hit the Windows Key on the keyboard of your windows desktop/laptop and type cmd. Command Prompt should pop up so launch that. Then click on the down arrow at the top of the Command Prompt window. This should cause a menu to pop up. Near the bottom of that menu choose Settings:

On the left hand side of the screen near the bottom choose Add a new profile

Then choose New empty profile:

Then, in the Command Line section, type ssh htkh@192.168.0.200 replacing htkh with the username you used to install Ubuntu Server and 192.168.0.200 with the IP Address of your server:

Then click Save
When you now launch Command Prompt you can click on the down arrow and select your new profile from the menu. In this example, I’d choose Profile 15. You should then be presented with a screen like this, prompting you to enter the password for your Ubuntu Server user:

SSH from Windows to your Ubuntu Server without entering a password
Currently, we are prompted to enter our password each time we connect using this new saved profile. We can go one better and add our Windows desktop/laptop as a trusted connection. This will mean that we can connect to our server without having to type our password each time, we will be taken straight to the Ubuntu command line.
So, from a Windows Command Prompt on your Windows machine type the following to generate a key pair:
ssh-keygen -t rsa -b 4096
When prompted to Enter file in which to save the key leave it blank. When prompted leave the password blank too. This command will create two keys: One of the keys is a private key which we NEVER share. The other is called a public key which we can share with others. In this instance, we will be sharing it with our Ubuntu Server. So, we need to copy the public key over to our Ubuntu server by typing the following:
type c:\users\[username]\.ssh\id_rsa.pub | ssh htkh@192.168.0.200 "cat >> ~/.ssh/authorized_keys"
obviously replacing [username]
with your username. You also need to change the htkh@192.168.0.200
part to be the username and IP address of your Ubuntu Server.
Now try logging into our server using the Saved Profile above. Hopefully it should take you straight into your server! But what if it is STILL prompting you for a password?
I am still being prompted to enter my password
If this happens there are a few things to check:
Check the key was copied across to your server:
To see the public key on your Ubuntu Server type the following command on your Ubuntu Server command line:
cat .ssh/authorized_keys
To see the public key on your Windows desktop/laptop either open the file using Notepad or type the following command in a Command Prompt:
type
c:\users\[username]\.ssh\id_rsa.pub
obviously replacing [username]
with your username.
The last entry (or the only entry) displayed on both your Windows machine and your Ubuntu server should be the same.
Check the permissions on the .ssh folder:
You can check the permissions on the .ssh folder by typing the following command on your Ubuntu Server command line:
ls -al ~
The permissions should look like this:

If they do not, you can change them by issuing the following command on your Ubuntu Server command line:
chmod 700 .ssh
Check the permissions on the authorized_keys file:
You can check the permissions on the authorized_keys file by issuing the following command on your Ubuntu Server command line:
ls -al ~/.ssh/authorized_keys
They should look like this:

If they do not, then issue the following command on your Ubuntu Server command line to change them:
chmod 600 .ssh/authorized_keys
Now try and connect using your Saved Profile above.