I am trying to use vagrant, Clojure and emacs together. Specifically, I can't connect cider to my vagrant machine.
It works locally, when I run cider-jack-in inside my project.
But I don't know what are the steps to do that inside the same project (synced via vagrant shared folders) on the vagrant machine.
Here is my attempt so far :
ssh vagrant, thencd my-project-dir, thenlein repl- in emacs,
cider-connect, input[email protected], port22
I get the following message :
SSH port forwarding failed. check the nrepl-tunnel buffer.
Inside that buffer :
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011 Privileged ports can only be forwarded by root.
Process nrepl-tunnel exited abnormally with code 255
Ho do I run that as root ? Is it really the problem ? Should I use another port ? Do I have to put something specific in my Clojure code to enable that ? The directions given here are a bit unclear to me.
Note : it differs from this question because emacs runs on the host machine, not on the vagrant machine
Edit :
Here are the detailed steps I did, thanks to @Shlomi's answer :
Edit .ssh/config by adding the following (edit IP according to you
Vagrantfile) :Host vagrant HostName 192.168.50.50 Port 22 User vagrant ForwardAgent yes
in the host, start my project with
lein repl. Pay attention to the port in the message :nREPL server started on port 42018 on host 127.0.0.1 - nrepl://127.0.0.1:42018in emacs,
M-x cider-connect, input vagrant, your password and the port noted by the previousleincommand.That's it :)