brockgr / csshx

Automatically exported from code.google.com/p/csshx
433 stars 75 forks source link

Question: is there a way to set an env var in the terminal that is running ssh #110

Open ppi-agray opened 6 months ago

ppi-agray commented 6 months ago

I have the following use case: I can run the following command just fine: (those are AWS Instances I'm ssh'ing onto):

ssh i-0518b235de43acdcd 
ssh i-0ba5ca0c58dbfeebb

My ssh config has the following, which makes those ssh commands work:

host i-*
  ProxyCommand aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters "portNumber=22"
  IdentityFile ~/.ssh/id_rsa
  User ec2-user

But it ONLY works if my AWS Access and Secret key (or profile) are set in the terminal that is running ssh.

When I run csshX i-0518b235de43acdcd i-0ba5ca0c58dbfeebb, it launches the Terminal.app in a NEW window that does NOT have those access/secret (or profile) set, so ssh fails.

Is there a way to call csshX to set some env vars (or run a script) in Terminal.app PRIOR to running the ssh command?

Thanks!