Hello World

Be Happy!

generate ssh private public key and regist pub to server


1. generate ssh key in client

$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/home/.ssh/id_rsa): /Users/home/.ssh/helloworld
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /Users/home/.ssh/helloworld.
Your public key has been saved in /Users/home/.ssh/helloworld.pub.
The key fingerprint is:
SHA256:13ie4XNSktKm16yfTX4Gv1GbYxMBOh9kKTXF1tajM34 home@MacBook-Pro.local
The key's randomart image is:
+---[RSA 2048]----+
|            .*+.o|
|           .+.o++|
|           o..oo.|
|           +o=. .|
|        S + X.+..|
|         . B O.E=|
|          . B =X.|
|           . =.=B|
|            ..oo=|
+----[SHA256]-----+

2. upload public key file to server

cat ~/.ssh/helloworld.pub | ssh USER_ID@SERVER_ADDRESS "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >>  ~/.ssh/authorized_keys"

3. connect server without your password (using private key file)

ssh -i ~/.ssh/helloworld USER_ID@SERVER_ADDRESS
#ssh (3) #ssh-keygen (1)
List