Mach30 / kasm-dof-workspace

Mach 30 Distributed OSHW Framework Workspace (Kasm Image)
Other
1 stars 1 forks source link

ssh keys not persisting in ssh-agent between sessions #7

Closed capsulecorplab closed 1 year ago

capsulecorplab commented 1 year ago

Restarting kasm requires rerunning ssh-add ~/.ssh/id_ed25519. Otherwise, ssh keys don't work

j-simmons-phd commented 1 year ago

Use Keychain (already installed in the image) per the following instructions

Create New SSH Key

$ ssh-keygen -t ed25519 -C "simmons@j-dot.org"
# follow prompts and set a password

Add new SSH Key to SSH-Agent

$ eval "$(ssh-agent -s)"
> Agent pid 59566
$ ssh-add ~/.ssh/id_ed25519

Add new SSH Key to GitHub

$ cat ~/.ssh/id_ed25519.pub
# Then select and copy the contents of the id_ed25519.pub file
# displayed in the terminal to your clipboard
  1. Go to Settings->SSH and GPG keys in Github
  2. Click New SSH key or Add SSH key
  3. Enter title and copy/paste the key from the command above, then click Add SSH Key
  4. Verify access with following commands
    $ ssh -T git@github.com
    # Attempts to ssh to GitHub
    > The authenticity of host 'github.com (IP ADDRESS)' can't be established.
    > RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
    > Are you sure you want to continue connecting (yes/no)?
    # answer yes
    > Hi username! You've successfully authenticated, but GitHub does not
    > provide shell access.

Set Keychain to auto-launch

$ sudo apt install keychain  # installed in the kasm image already
# add the following to ~/.bashrc (~/.profile in kasm images)
# also set terminal preferences to launch as login shell in kasm
# eval `keychain --eval id_ed25519`
$ source ~/.bashrc