How to use an ssh config file to automatically change directories on login

Seems simple enough, but it took a couple sessions for me to figure out the magical combination.

The context is that at work we have multiple sandboxes. There are personal ones and then a development and staging sandbox everyone pushes to. I wanted to run this simple Alfred workflow I use which pulls from my ssh config file and be able to plop down into the sandbox I wanted.

Resources

https://linux.die.net/man/1/bash

https://man.openbsd.org/ssh_config

Host sandbox
  HostName sandbox.thisbailiwick.com
  User username
	PreferredAuthentications publickey
	IdentityFile ~/.ssh/personalid
  RemoteCommand cd ../path/to/other/sandbox; bash --login
  RequestTTY force

Leave a Reply

Your email address will not be published. Required fields are marked *