Joyent

Enabling SSH Tunneling

Tunneling is used for many things. One example is creating a tunnel to access your database on the Accelerator from your machine. This is using MySQL as an example to prove that tunneling is working successfully.

Editing configuration files

  1. Edit /etc/ssh/sshd_config
    • Change the following parameters to “Yes”:
AllowTcpForwarding yes
GatewayPorts yes
  1. restart SSH
# svcadm restart svc:/network/ssh:default
  1. Checking to ensure that SSH properly restarted:
# svcs -a | grep -i ssh
online 21:31:42 svc:/network/ssh:default

The “21:31:42” is the time at which it last changed state, in this case, the time at which we restarted it.

  1. Make sure the MySQL Server is configured to accept non-localhost connections. Edit /opt/local/etc/my.cnf
    • Make sure the following line is commented out (precede with a #)
#skip-networking
  1. Restart MySQL
mysqladmin shutdown -u root -p

Testing it out

  1. First lets create the tunnel from local:3307 to remote:3306
    1. ssh -L3307:127.0.0.1:3306 -p 22 -N -t -x user@myhost.com
  2. Then lets see if we can connect to the MySQL database on our Accelerator
    1. mysql -u USER -pPASSWORD -h 127.0.0.1 -P 3307
 
accelerators/kb/ssh/enable-tunnel.txt · Last modified: 2008/01/27 01:12 by alexbcoles
 
Recent changes RSS feed Creative Commons License Driven by DokuWiki