ssh in windows 11 – without putty, without ssh-agent

by

in

You can do everything from windows cmd. There is no need to install putty or any other program, just 3 easy steps:

  1. Create a public and private key pair.
  2. Copy the public key to the server.
  3. Login with ssh through windows cmd.

The above steps in detail:

Create the keys in your windows 11 machine

Open cmd and type:

ssh-keygen -t ed25519 -C "[email protected]"

Follow the instructions on screen. When asked for password, type one. Although you can leave it empty, it is strongly recommended it not to.

Two files are created:

ed25519.pub and ed25519 without an extension. The first one is the public key and the second is the private. Keep them in a safe place. If someone has access to the file, will have access to your servers.

Copy or type your public key to your ubuntu / debian / any linux machine

Open your ed25519.pub file with a text editor, notepad is sufficient enough. Select all text and copy it to notepad. Now, login to your linux machine and locate the file:

~/.ssh/authorized_keys

It the file does not exist create it.

If the file has already contents, add another line and paste the contents of ed25519.pub.

If the file is empty, just paste the contents of ed255519.pub.

Now, to enable passwodless login, locate the ssh configuaration file:

/etc/ssh/sshd_config 

Make sure that the following parameters are set properly:

PasswordAuthentication no
ChallengeResponseAuthentication no
UsePAM no

To apply the settings, restart ssh like this:

sudo systemctl restart ssh

Access linux from your windows 11 cmd

Open cmd again and use ssh to login to remote machine. The difference from typical password authentication is that you must provide the -i switch which allows to define the private key you created in step one.

ssh -i .\path_to\ed25519 [email protected]

Of course, you can use any filename you like.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *