From 00403b51019e32328fa18004960517c80712bd16 Mon Sep 17 00:00:00 2001 From: bonnie Date: Mon, 4 Nov 2019 00:08:19 +0800 Subject: [PATCH] add ssh commands to 'System' --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index c08ae44..cba5ec6 100644 --- a/README.md +++ b/README.md @@ -1270,6 +1270,26 @@ xcowsay ## System [[back to top](#handy-bash-one-liners)] + +##### Generate public key from private key +```bash +ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub +``` + +##### Copy your default public key to remote user +```bash +ssh-copy-id @ +# then you need to enter the password +# and next time you won't need to enter password when ssh to that user +``` + +##### Copy default public key to remote user using the required private key (e.g. use your mykey.pem key to copy your id_rsa.pub to the remote user) +```bash +# before you need to use mykey.pem to ssh to remote user. +ssh-copy-id -i ~/.ssh/id_rsa.pub -o "IdentityFile ~/Downloads/mykey.pem" @ +# now you don't need to use key to ssh to that user. +``` + ##### Follow the most recent logs from service ```bash journalctl -u -f