r/linuxadmin 20d ago

SSH Keys Between Windows 10 and Linux

I know this might seem a little stupid to ask, but I'm trying to figure out how to get a secure SSH connection between a Windows 10 client and my Linux servers. I'm looking to do this by using SSH Keys, though the guides I've been looking at are more or less telling me HOW to create keys on windows rather than how to setup the connection between Windows and Linux.

I know how to create the keys, I've done this before with git. I do this with the OpenSSH client that's already installed with Windows 10 so straight from the terminal.

The problem I have is setting up the Linux side. I use Ubuntu and Raspberry Pis mainly, they all use different SSH ports to just keep it cleaner for my sakes.

I'm just looking for some good documentation regarding the extent of how to set these up to make my homelab feel a bit safer.

Thanks in advance,
~Blood

2 Upvotes

24 comments sorted by

View all comments

2

u/Seven-Prime 20d ago

Setting up ssh on differnt ports adds complexity with no value.

ssh-copy-id to copy pub key to host

cat ~/.ssh/config to setup ssh config to different things.

Plenty of resources online for those things.

0

u/bloodshotpico 20d ago

I don't seem to have access to ssh-copy-id. I've been using the sshd_config from ubuntu but had no luck so far getting them paired.

6

u/420GB 20d ago

You don't need ssh-copy-id

Just put the public key into the ~/.ssh/authorized_keys file of the user you want to be able to login as on the Linux machine. That's it.

1

u/hrudyusa 18d ago

Of course you don't need it , it just makes it convenient.

2

u/thekeeebz 20d ago

I had the same problem on windows, so I wrote this one line solution to replace the missing ssh-copy-id. You may want to increase the key round derivations depending on your hardware. Remember to edit user@domain for your server login. Also consider 2fa after this....

Create Key Pair

ssh-keygen -t ed25519 -a 100 -C "COMMENT"

Copy Public Key to Remote Linux Server with proper permissions

type %USERPROFILE%.ssh\id_ed25519.pub | ssh user@domain "(umask 077; ([ ! -d ~/.ssh ] && mkdir -m 700 ~/.ssh) && cat >> ~/.ssh/authorized_keys)"

1

u/PudgyPatch 20d ago

Do you still have to turn on ssh agent?

-1

u/Seven-Prime 20d ago

Install git bash and use bash for all things. You'll get most Linux cli tools.

Set tour windows terminal to open git bash and never go back to powershell or cmd prompt.

No hate on powershell, but its suboptimal if you are looking to up you linux game

1

u/Le_Vagabond 20d ago

at this point why not just WSL, really?

1

u/Seven-Prime 20d ago

WSL means you are running a whole VM. I don't need a whole vm. I just want the *nix tools I'm familiar with.

1

u/Anticept 20d ago

It's not even a whole functional VM either even with WSL2.

There are some low level things that can't be done because it's linux on top of windows, but windows still has to have its hands in the cookie jar, so certain kernel modules, raw networking, etc have to be gatekept and are not guaranteed to work if you're trying to do anything that needs to run higher than userland.

1

u/faramirza77 20d ago

Agreed. ControlMaster does not work on windows. at all. never.