/
Seamless ssh access

Seamless ssh access

If you have access to multiple class accounts or vx/exam accounts, as part of your workflow, you may want to ssh into another account from the account you are currently at.

  1. Start ssh agent in your current login session. This can be achieved in your .xsession

  2. Add your private key to the agent using ssh-add. You can store multiple identities in the agent.

  3. Forward the agent - Either use “ssh -A” or add “ForwardAgent yes” to your ~/.ssh/config

~/startsshagent script

#!/bin/bash SSH_ENV=~/.ssh/environment.`hostname` function start_agent { echo "Initialising new SSH agent..." /usr/bin/ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV} echo Succeeded chmod 600 ${SSH_ENV} . ${SSH_ENV} /usr/bin/ssh-add ~/.ssh/id_rsa < /dev/null } # Source SSH settings, if applicable if [ -f "${SSH_ENV}" ]; then echo "Found ${SSH_ENV}" . ${SSH_ENV} ps -ef | grep ${SSH_AGENT_PID} | grep 'ssh-agent' || { start_agent; } else start_agent; fi

~/.xsession script

. ~/startsshagent exec startxfce4

~/.ssh/config

Host * ForwardAgent yes ForwardX11 yes StrictHostKeyChecking no

Other Methods

  • In your .xsession,

exec ssh-agent startxfce4

  • In your xterm,

eval $(ssh-agent)

Related content

How to use vlab
Read with this
Multiple Exam Accounts
Multiple Exam Accounts
More like this
Personal Computers provided by CSE
Personal Computers provided by CSE
Read with this
Virtual Exams Instructions
Virtual Exams Instructions
More like this
Self-administered computers
Self-administered computers
Read with this
Get Started
More like this