change directory automatically on ssh login
- by Gareth
Hi,
I'm trying to get ssh to automatically change to a particular directory when I log in. I tried to get that behaviour working using the following directives in ~/.ssh/config:
Host example.net
LocalCommand "cd web"
but whenever I log in, I see the following:
/bin/bash: cd web: No such file or directory
although though there is definitely a web folder in my home directory. Even using an absolute path gives the same message. To be clear, if I type cd web after logging in I get to the right folder.
What am I missing here?
EDIT:
Different combinations of quotes/absolute paths give different error messages:
LocalCommand "cd web"
/bin/bash: cd web: No such file or directory
LocalCommand cd web
/bin/bash: line 0: cd: web: No such file or directory
LocalCommand cd /home/gareth/web
/bin/bash: line 0: cd: /home/gareth/web: Input/output error
This makes me think that the quotes shouldn't be there, and that there's another error happening.