anoushkrit / open-setups

step-by-step guides to installing various softwares which don't have an easy way to get installed
GNU General Public License v3.0
0 stars 0 forks source link

ssh-keygen passwordless setup #2

Open anoushkrit opened 10 months ago

anoushkrit commented 10 months ago

Setting up ssh-key and then copying and pasting it to the remote server.

https://stackoverflow.com/questions/66113731/how-to-save-ssh-password-to-vscode

On VS Code, edit the .ssh config file

Host <myhost>
  HostName <myhost>
  User <remoteuser>
  Port 22
  PreferredAuthentications publickey
  IdentityFile "/Users/<localuser>/.ssh/keys/<myhost>_rsa"
anoushkrit commented 10 months ago
Host <myhost>
  HostName <myhost>
  User <remoteuser>
  Port 22
  PreferredAuthentications publickey
  IdentityFile "<path_to_your_private_key>"

ssh-keygen -q -b 4096 -P "" -f <path_to_your_private_key> -t rsa

anoushkrit commented 10 months ago

ssh-copy-id -i "<path_to_public_key_generated_by_keygen.pub>" <host_name>@<host_ip>

anoushkrit commented 10 months ago

chmod 600 <path_to_private_key> chmod 644 <path_to_public_key>

anoushkrit commented 10 months ago

ssh <remoteuser>@<myhost> should run smoothly and without password