Skip to content

Instantly share code, notes, and snippets.

@ZilchBloke
Last active April 18, 2023 00:19
Show Gist options
  • Save ZilchBloke/c1f4372545e1c0713158b1030c6fdd17 to your computer and use it in GitHub Desktop.
Save ZilchBloke/c1f4372545e1c0713158b1030c6fdd17 to your computer and use it in GitHub Desktop.
ssh-keygen (ed25519) and ssh-copy-id for powershell. (windows client to linux server)

One Line ssh-keygen (ed25519) and ssh-copy-id for powershell. (windows client to linux server)

ssh-keygen -o -a 100 -t ed25519 -f $env:USERPROFILE\.ssh\server_key -C "ServerUsername@ServerHostname" && cat $env:USERPROFILE\.ssh\server_key.pub | ssh linuxUser@linuxServer "mkdir ~/.ssh/ ; touch ~/.ssh/authorized_keys ; cat >> ~/.ssh/authorized_keys"

Fill the above command with relatable entry for you

Variables Description
server_key.pub Filename of your public key. Located in $env:USERPROFILE\.ssh\ . It could be id_ed25519.pub or id_rsa.pub or whatever. In this case it is server_key.pub
`-C "ServerUsername@ServerHostname" '-C' is comment option and comment are written between " ", to relate the key to the server.
linuxUser User of the server(linux machine)[in this case, linuxServer],with which we are using ssh to connect to the server.
linuxServer Hostname of the server machine, to which connection is being made by the user in this server(in this case, linuxUser).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment