ubuntu create ssh key code example

Example 1: macos create ssh key

ssh-keygen -t rsa

Example 2: ubuntu generate ssh key

ssh-keygen -t rsa -C "[email protected]"

Example 3: how to generate ssh key in linux

ssh-keygen -t rsa -b 4096
ssh-keygen -t dsa
ssh-keygen -t ecdsa -b 521
ssh-keygen -t ed25519

Example 4: how to generate ssh key in ubuntu

ssh-keygen -t rsa 4056

Example 5: ubuntu create a ssh key

cat ~/.ssh/id_rsa.pub | ssh username@remote_host "mkdir -p ~/.ssh && touch ~/.ssh/authorized_keys && chmod -R go= ~/.ssh && cat >> ~/.ssh/authorized_keys"

Example 6: ubuntu add public key to server

ssh-copy-id -i ~/.ssh/id_rsa.pub user@server