ssh client-server key pairing a nightmare
as usual, i'm a super noob ("noob noob") and cant follow basic instructions, so time to naggy myself
my poopy terms:
- client : the local pc you interact with directly, the one you typing on
- server : the remote pc/server you want to ssh into, the one with (hopefully) the powderful compute
tested on linux & windows
macos not tested, maybe similar to linux instructions (i dunno, spoil your mac not my fault)
please note the following:
- client
- tested on both linux and windows
- server
- linux only
- nobody use windows server
generate key on your client pc
both linux and windows instructions alike
ssh-keygen [options]
## -t <type> : encryption tpye/implementation. eg rsa, tsa, ecdsa, ed25519
## -b <bit> : encryption bits
you will be prompted for 2 things
key file name and location
- linux (default) : ~/.ssh/<key_name>
- windows (default) : C:\Users\<user_name>\.ssh\<key_name>password
- leave blank for no password (just press enter twice on prompt)
- naggy repeat password
see here for more detailed guide and options
copy public key from client to server
public key in the format <key_name>.pub
send key to server, from your client pc
server cannot directly access ur client pc key! (or maybe can i dunno :0)
linux : the better terminal
ssh-copy-id -i <path_to_client_key>/<client_key_name>.pub <server_username>@<remote_host_name>
## -i : input public key path, <path_to_client_key>/<client_key_name>.pub
windows : powder shell
open POWERSHELL on windows
NOT command prompt (it useless)
why use windows? so junky
cat ~/.ssh/<client_key_name>.pub | ssh <server_username>@<remote_host_name> "cat > ~/.ssh/authorized_keys"
explaining cat ~/.ssh/<client_key_name>.pub
:
- accessing your windows client public key file
- in linux format
- ~
here represents C:\Users\<client_username>\
cos windows extra
explaining "cat > ~/.ssh/authorized_keys"
:
- store your client public key to server
- so server recognise client (know you and friend you)
- ~
here represents /home/<server_username>/
once done, open new ssh session on the client added to server, and should not need any password
if not, suck thumb and cry :) jkjk
if there is missing instructions, please dont beat me up, i fragile
cheers,haha noob noob de ni
Subscribe to my newsletter
Read articles from Loo Tan Rong directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by