SSH into Specified Directory by Default?

2019-06-03 22:48发布

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

标签: ssh debian
1条回答
在下西门庆
2楼-- · 2019-06-03 23:08

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.

查看更多
登录 后发表回答