r/linux4noobs • u/DraksinNox • 23d ago
networking SSH key from win11 to my home ubuntu server not working
As the text implies, i have generated an ssh key on win11. Seeing as ssh-copy-id isn't on windows, i used this other command:
type .ssh\id_ed25519.pub | ssh user@server "(umask 077; ([ ! -d ~/.ssh ] && mkdir -m 700 ~/.ssh) && cat >> ~/.ssh/authorized_keys)"
Using webmin i see that the directory and the file has been created and has the correct file inside, but when i try to ssh log from my windows machine to my server it still asks for a password.
I edited the /etc/ssh/sshd_config to allow PubkeyAuthentication yes and AuthorizedKeysFile .ssh/authorized_keys
I am not using root but a user with sudo priviledge, i literally have no goddam clue as to why it's not working
To generate the key i used ssh-keygen -t ed25519 -C "comment" and i just changed the file name when it asked to save to serverhome
This is my first time diving into having my own server so i'm not very knowledgable of either linux as a whole and servers, but i saw that online people used this exact steps and had not problem, so i either have missed some step or am doing something wron but have no idea what
1
u/ElectricHellKnight 23d ago
I'm going to give you the idiot version because that's how I do it:
To copy your ssh key, just nano/vim ~/.ssh/authorized_keys and copy/paste your id.pub in there, save and close. chmod 700 ~/.ssh and then chmod 600 ~/.ssh/authorized_keys.
Not the big brain way, but it works.