remote_host 'localhost'. , 127.0.0.1 (localhost), SSH- IP- ( remote_host).
Ssh linux sudo netstat -n --tcp --listen -p. , :
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
...
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 1552/postgres
, postgres 127.0.0.1 ( Local Address). psql -h 127.0.0.1, . psql -h <hostname> psql -h <my external IP>, .
, ssh.forward.local(4444, remote_host, 5432), . ssh.forward.local(4444, 'localhost', 5432), .
:
Net::SSH.start(remote_host, user_name, :password => password) do |ssh|
ssh.forward.local(4444, 'localhost', 1234)
ssh.loop { true }
end
, "localhost" , ssh, .. .