Skip to content

Instantly share code, notes, and snippets.

@AndreaGhizzoni
Last active April 24, 2018 20:05
Show Gist options
  • Save AndreaGhizzoni/1a880551343370dd8e5802c484791ac9 to your computer and use it in GitHub Desktop.
Save AndreaGhizzoni/1a880551343370dd8e5802c484791ac9 to your computer and use it in GitHub Desktop.
ssh.md

SSH

For Windows

Download GitBash from here, run git-bash.exe that is a custom MINGW64 for git and run the same commands as linux. Replace every *.local name with the corresponding IP address.

Generate RSA keys

To generate a public and private keys under ~/.ssh run the following command:

$ ssh-keygen -t rsa -C "[email protected]"
$ ls ~/.ssh
config   id_rsa   id_rsa.pub

Windows: The generated keys are in /c/Users/name/.ssh/

Use RSA keys to log via SSH

Let's assume that we want to log into a server called gitserver.local as git user via ssh. We don't want to type the local user's password of git user every time we want to connect, so let's run this command:

$ ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]

Running single command through SSH

$ ssh -t [email protected] echo "HelloWorld" <arg1> ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment