How to modify terminator config to first ssh to a remote server and then switch to a specific directory?

0

I have modified my ~/.config/terminator/config to automatically ssh me to a remote server foobar by using line

custom_command = ssh foobar

but I don't know how to change to a specific directory afterwards

custom_command = ssh foobar; cd baz/quux

does not work.

Boris Stitnicky

Posted 2016-09-15T13:40:26.730

Reputation: 101

Try custom_command = ssh foobar && cd baz/quux and report back. If that doesn't work this may need to be configured server-side. – I_GNU_it_all_along – 2016-09-15T13:58:16.463

@I_GNU_it_all_along, no good – Boris Stitnicky – 2016-09-15T14:16:38.187

1What about custom_command = ssh -t foobar "cd baz/quux ; bash"? – I_GNU_it_all_along – 2016-09-15T14:38:37.480

@I_GNU_it_all_along, make it into a full fledged answer and I'll change the accepted answer to you. – Boris Stitnicky – 2016-09-15T15:30:39.067

Nah, it's cool, I'll let Brian have his rep ;) – I_GNU_it_all_along – 2016-09-15T15:33:06.627

Answers

0

The correct answer was introduced in a comment by user I_GNU_it_all_along:

custom_command = ssh -t foobar "cd baz/quux ; bash"

Boris Stitnicky

Posted 2016-09-15T13:40:26.730

Reputation: 101

1

What about dropping the ; from your custom_command? As in:

custom_command = ssh foobar cd baz/quux

This should just execute the command once login is accepted, as per ssh documentation.

For a more permanent solution, you could always modify the .bash_profile (or similar) on the server to always change directories on login.

Brian E

Posted 2016-09-15T13:40:26.730

Reputation: 11

@BorisStitnicky - Give us reviewers an ultimatum isn't constructive. – Ramhound – 2016-09-19T15:39:31.210

Rejecting an edit that corrects an obviously incorrect answer is not constructive either, :wink: – Boris Stitnicky – 2016-09-19T16:14:44.420