:: krowemoh

Thursday | 26 DEC 2024
Posts Links Other About Now

previous
next

Passing Passwords to SSH

2023-09-19
windows, sysadmin

The ssh client in Windows doesn't let you pass passwords in directly and Windows doesn't support sshpass so the next best thing is to use a custom version of ssh that has a flag to pass in the password.

SSH Releases

You can place ssh.exe and libcrypto.dll in C:\bin. C:\bin is a folder I created to hold these portable executables.

Now we can create a function and an alias in the Windows Terminal profile.

Open the profile by opening powershell and typing in:

notepad $PROFILE

This will open notepad and then you can add the following lines:

function Myserver { C:\bin\ssh.exe -Z "password" username@192.168.11.11 }
Set-Alias asd Myserver

Now you refresh the session by:

. $PROFILE

Now we can use asd to connect to our server without having to enter the password in directly.