问题原文
原帖链接 · Bob Flemming · CC BY-SA 3.0
I was wondering if there is a way to change the default directory that I get put into after I SSH into my Ubuntu server.
99% of the time when I'm logging into my server, it is to access files within a specific directory:
/var/www/websites
Is there a config file that I can edit that will make sure I am put straight into this directory when I login?
社区高分解答
原帖链接 · igorsantos07 · CC BY-SA 4.0
Since OpenSSH 7.6, you can use the new RemoteCommand option to achieve that.
In your ~/.ssh/config:
Host websites-my-host
HostName <realhostname>
IdentityFile ~/.ssh/keyfile
User webmaster
RequestTTY force # check if this is necessary
RemoteCommand cd /var/www/websites && bash -l
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
