change directory automatically on ssh login
Posted
by
Gareth
on Server Fault
See other posts from Server Fault
or by Gareth
Published on 2010-08-05T14:40:37Z
Indexed on
2010/12/21
21:56 UTC
Read the original article
Hit count: 302
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.
© Server Fault or respective owner