Connect

SSH-Keys

Image generated with ChatGPT
slides by Lukas Steinwender

SSH-Keys?

  • secure way to access remote machines without a password
  • based on encryption

NEVER share the private key with anyone!

flowchart LR
    subgraph Local Machine
        priv@{ shape: rounded, label: "Private Key"}
        pub_loc@{ shape: rounded, label: "Public Key"}
    end

    subgraph Remote Machine
        pub_rm@{ shape: rounded, label: "Public Key"}
    end

    enc@{ shape: rect, label: "Encryption Math"}

    pub_loc -.->|upload once| pub_rm
    priv -->|login request| enc <-->|compare| pub_rm
slides by Lukas Steinwender

Generating a Key-Pair

#generate a key-pair
ssh-keygen -t ed25519 -f <key filename> -C <your email/user>                                                    
#content of ~/.ssh/config
Host <shortcut to use for connecting>
    HostName <host address>
    User <username>
    ForwardAgent yes
	ForwardX11 yes    #for interactive window forwarding
    IdentityFile <path to private key>
Host github #for github
    HostName github.com
    User git
    IdentityFile ~/.ssh/github                                                                           
  • copying to remote host
ssh-copy-id -i <key filename> user@host                                                                         
slides by Lukas Steinwender

SSH-Agent Not Running?

  • activate
eval "$(ssh-agent -s)"                          #linux
Invoke-Expression -Command "$(ssh-agent -s)"    #windows 
  • add key to session
ssh-add <key name>
slides by Lukas Steinwender

SSH Agent Forwarding

  • allows using of GitHub on OzStar
  • add the following to your .bashrc (.bash_profile file)
echo "Setting up agent forwarding"      #make sure script talks to me
eval "$(ssh-agent -s)"                  #get agent
ssh-add ~/.ssh/github                   #forward github sshkey
  • Testing (on OzStar)
ssh -T git@github.com
slides by Lukas Steinwender

SSH and GitHub

ssh -T git@github.com
slides by Lukas Steinwender

`ed25519` ... encoding protocol