How to make SSH go directly to specific directory?

后端 未结 3 1916
孤城傲影
孤城傲影 2021-02-07 03:02

when you do an \"ssh second_machine\" you are able to connect to second_machine on your home directory

But usually i am working in my_machine in directory with very long

3条回答
  •  醉酒成梦
    2021-02-07 03:48

    This should work for you

    ssh  -t second_machine "cd /very/long/path/to/directory/; bash"
    

    Assumes you're wanting to run bash, substitute for a different shell if required.

提交回复
热议问题