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"
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). |