18

I've installed CouchDB on a remote server that I have access to through a terminal telnet/ssh client.

The server is running on CentOS6.

I really want to be able to work with Futon, but I cannot at the moment because I can only open localhost:5984 in the ssh client.

Any suggestions on how to work around this?

user1163278
  • 411
  • 6
  • 20

1 Answers1

30

Just create ssh tunnel to your remote CouchDB instance:

ssh -f -L localhost:15984:127.0.0.1:5984 user@remote_host -N

And after that your remote CouchDB Futon that still serve on localhost address will be available for you by address: http://localhost:15984/_utils. Replace local port 15984 by your choice.

P.S. There is also awesome guide from Linode wiki with example couchdb-tunnel script. Hope it helps.

Kxepal
  • 4,659
  • 1
  • 19
  • 16
  • I get this error in FUton: "Error: error {{badmatch,{error,eacces}}, [{couch_file,init,1},{gen_server,init_it,6},{proc_lib,init_p_do_apply,3}]}". Have you experienced that? – user1163278 Apr 07 '13 at 17:44
  • `eacces` error is about insufficient permissions for file operations. Have your `couchdb` used read/write permissions for his database/logs directory? See [p4.1](http://wiki.apache.org/couchdb/Installing_on_RHEL5#Building_CouchDB_from_source_.28with_EPEL_packages.29) for additional info. – Kxepal Apr 07 '13 at 17:49
  • Thanks again. Your a genius. Saved me a lot of time. Kudos. Have a nice day. – user1163278 Apr 07 '13 at 17:56
  • 1
    also check out autossh to maintain persistent ssh tunnels. http://www.debianadmin.com/autossh-automatically-restart-ssh-sessions-and-tunnels.html – Noah Apr 09 '13 at 13:27
  • wow! Didn't know you could do this; this opens up so many doors. Thx. – Jordan Arsenault Apr 13 '13 at 22:17
  • 1
    lovely! I've used the minGW shell on Windows to get the tunnel up and running, had to remove the -f option tho. http://www.mingw.org/ – Michel Feldheim Jun 20 '13 at 12:38
  • `Permission denied, please try again.` should I change something before I tunnel to my server couchdb? – Yuseferi Oct 28 '16 at 07:09
  • How do I do this when my remote couchdb also has a username and password? Usually I would connect with http://username:password@127.0.0.1:5984/_utils if it was local – Bobby S Feb 24 '17 at 21:55