SSH into Specified Directory by Default?

2019-06-03 23:22发布

问题:

By default, when SSH'ing into a client I am automatically placed into /home/marco/ but instead I would like to be placed into /something/other. I would prefer to keep my home directory where it is, but I would like to be automatically routed to /something/other/

Is this possible?

*The client runs Debian 5.04

回答1:

You can pass the command in the ssh to change the directory at the same time you login:

ssh -t localhost "cd /tmp ; bash"

You might get what you want after an alias:

alias ssh-tmp='ssh -t localhost "cd /tmp ; bash"'

So command 'ssh-tmp' will put you directly in the tmp directory.



标签: ssh debian