User Tools

Site Tools


programming:bash:ssh_connection

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
programming:bash:ssh_connection [2012/08/26 09:41] – created sbolayprogramming:bash:ssh_connection [2015/09/21 12:42] (current) – [Gateway/Proxy] sbolay
Line 145: Line 145:
 In my point of view, it is better to connect to the remote server as a regular user instead of root for security purpose. If you need root access, configure the /etc/sudoers file by invoking visudo (man visudo) so you can selectively grant access to users. In my point of view, it is better to connect to the remote server as a regular user instead of root for security purpose. If you need root access, configure the /etc/sudoers file by invoking visudo (man visudo) so you can selectively grant access to users.
  
 +===== Gateway/Proxy =====
 +
 +SQL Server(localhost:3306) ------FW----GATEWAY(localhost:1212)---FW----SQL Client(localhost:2424)
 +
 +On the GATEWAY machine:
 +  ssh -nNf -L 1212:localhost:3306 SQL_Server
 +  ssh -nNf -R 2424:localhost:1212 SQL_Client
 +
 +Check if the port 2424 is opened on SQL Client machine
 +  # lsof -i :2424
 +  COMMAND  PID   USER   FD   TYPE DEVICE     SIZE/OFF NODE NAME
 +  sshd    5161   me     8u   IPv6 27808583   0t0      TCP localhost:2424 (LISTEN)
 +  sshd    5161   me     9u   IPv4 27808584   0t0      TCP localhost:2424 (LISTEN)
 +
 +And then, you can access your DB with
 +  mysql -u username -p pw --protocol=TCP --port=1212
 +
 +
 +===== LINKS =====
 +  * http://www.onlamp.com/pub/a/onlamp/excerpt/ssh_11/index1.html
 +  * http://shop.oreilly.com/product/9780596000110.do
programming/bash/ssh_connection.1345974080.txt.gz · Last modified: 2012/08/26 09:41 by sbolay