diff --git a/SSH-VPN-VNC/Questions.md b/SSH-VPN-VNC/Questions.md index 5796c330a027819f448dac9431f7efa7067d819e..15e137ac4d8f2eba676a23621d6fcd742f5c7e36 100644 --- a/SSH-VPN-VNC/Questions.md +++ b/SSH-VPN-VNC/Questions.md @@ -4,7 +4,7 @@ Please feel free to add you questions and anwsers. [[_TOC_]] -## Q: ssh using key authentication? +## Q: How to use ssh-key authentication? In order to connect passwordless to a remote server a key needs to be generated. ``` @@ -29,11 +29,34 @@ The key's randomart image is: | | +----[SHA256]-----+ ``` -It is recommended to use a password to encrpyt the private key `.ssh/id_rsa`. However, this password is then required to login. -Todo add infos on `ssh-agent` +It is recommended to use a password to encrpyt the private key `.ssh/id_rsa`. However, this password is then required each time to login. Using an `ssh-agent` can solve that problem. -# Q: How to transfer files between two VPN networks? +## Q: How to use an ssh-agent? +Using an SSH-Agent will make your connection even safer, as your private key is encrypted with a passphrase. To create a ssh-key goto [How to use ssh-key authentication?](#How-to-use-ssh-key-authentication?). + +Continue with how to use the ssh-agent: +```bash +# Launch the SSH Agent +eval `ssh-agent` +# this will add your ssh-keys from ~/.ssh/ +# You will be asked a passphrase if you have one +# this will add .ssh/id_rsa as default +ssh-add +# or any keyfile you created: +ssh-add .ssh/secret_key +# Copy the ssh-key (pub) to the server +ssh-copy-id [user]@[server] +# and connect +ssh [user]@[server] +# Kill the agent and all store secure information +ssh-agent -k +``` +**Tip: configure your `.ssh/config` file to use the correct key a server. Goto [SSH](SSH.md)** + +[Nice summary of how an ssh-agent works](https://smallstep.com/blog/ssh-agent-explained/) + +## Q: How to transfer files between two VPN networks? You should be able to use an SSH tunnel via a gateway server