Skip to content

Instantly share code, notes, and snippets.

@alvarovm
Created September 14, 2023 22:44
Show Gist options
  • Save alvarovm/56545abe47061790344b027a910ca464 to your computer and use it in GitHub Desktop.
Save alvarovm/56545abe47061790344b027a910ca464 to your computer and use it in GitHub Desktop.
$>unison /mnt/c/Users/v/docs/ ssh://logos//home/vama/docs/
Unison 2.52.1 (ocaml 4.04.2): Contacting server...
bash: line 1: unison: command not found
Fatal error: Lost connection with the server

https://alliance.seas.upenn.edu/~bcpierce/wiki/index.php?n=Main.UnisonFAQTroubleshooting

The command line "unison work ssh://remote.dcs.ed.ac.uk/work" fails, with "fatal error: could not connect to server." But when I connect directly with ssh remote.dcs.ed.ac.uk/work, I see that my PATH variable is correctly set, and the unison executable is found. In the first case, Unison is using ssh to execute a command, and in the second, it is giving you an interactive remote shell. Under some ssh configurations, these two use different startup sequences. You can test whether this is the problem here by trying, e.g.,

ssh remote.dcs.ed.ac.uk 'echo $PATH' and seeing whether your PATH is the same as when you do

ssh remote.dcs.ed.ac.uk [give password and wait for connection] echo $PATH One method that should always work is this [thanks to Richard Atterer for this]: log into the machine, set up PATH so the program is found execute

echo "PATH=$PATH" >>~/.ssh/environment

Then change PermitUserEnvironment yes in /etc/ssh/sshd_config

Restart ssh server sudo systemctl restart ssh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment