Skip to content

Instantly share code, notes, and snippets.

@farhad0085
Last active August 1, 2023 20:36
Show Gist options
  • Save farhad0085/8d7c58dbbb9c4eb60e0847b21146bb51 to your computer and use it in GitHub Desktop.
Save farhad0085/8d7c58dbbb9c4eb60e0847b21146bb51 to your computer and use it in GitHub Desktop.

SSH to server

generate ssh key

Run following command in your terminal (for windows, use git bash)

ssh-keygen -o

Enter a path to save the ssh key

/c/Users/farhad/.ssh/server_name

Note: Replace server_name with your convenient name.

Now copy the public key and upload in your server. (in case GCP, go to edit vm, and go to security and then save the key)

cat /c/Users/farhad/.ssh/server_name.pub

Login to server

ssh -i ~/.ssh/server_name server_ip_address_here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment