On the Net

|Main Blog|Yearning|  

Words of God


About Linux News and OpenSource




and below are my posts....


Friday, October 19, 2007

Making your ssh server to act as a gateway by port forwarding

Ok, this is quick. My objective is to access the web, webmin and ssh of serverX. See below the text diagram.


[My Linux desktop]<-->[Routers]<-->[ssh server]<-->[routers]<-->[serverX]


Here's how.

-Create a file named config inside your $HOME/.ssh/

#.ssh/config
User root
LocalForward 20000 10.9.2.6:80
LocalForward 22000 10.9.2.6:22
LocalForward 20001 10.9.2.6:10000

I'm accessing as root, and the IP Add is the IP of serverX, you may put the hostname if you have it on you host file or dns. Ok, when finished on the file, if I connect to the ssh server..

[root@my desktop ~]# ssh -l root ssh-server
root@ssh-server's password:
[root@ssh-server ~]#

After able to established an ssh connection, on my local terminal, those ports listed on the file will open.

tcp 0 0 127.0.0.1:20000 0.0.0.0:* LISTEN 26163/ssh
tcp 0 0 127.0.0.1:20001 0.0.0.0:* LISTEN 26163/ssh
tcp 0 0 127.0.0.1:22000 0.0.0.0:* LISTEN 26163/ssh
tcp 0 0 127.0.0.1:46279 127.0.0.1:22000 ESTABLISHED 26166/ssh
tcp 0 0 127.0.0.1:22000 127.0.0.1:46279 ESTABLISHED 26163/ssh
tcp 0 0 127.0.0.1:40487 127.0.0.1:20000 TIME_WAIT -
tcp 0 0 ::1:20000 :::* LISTEN 26163/ssh
tcp 0 0 ::1:20001 :::* LISTEN 26163/ssh
tcp 0 0 ::1:22000 :::* LISTEN 26163/ssh

Then you can just access those locally and you are going to be connected to the serverX via ssh. If you wish to access serverX web server, just open a the your browser with url

http://127.0.0.1:20000

or if you wish to open the webmin, then type

http://127.0.0.1:20001


Note: Don not dis engaged your ssh connection to the ssh server, else you wont be able to connect on those 2xxxx ports.

Well, its not an original trick, just found those by searching, I just need to compile for future reference.


Thanks.

Monday, October 01, 2007

VNC Server on Mandriva 2007

Accessing Mandriva desktop remotely via vncviewer.

-Install x11vnc via urpmi.
-Generate vnc password, use the command vncpasswd command, it can be done as a user.
-Lunch VNC server as a user from cli, use the command

x11vnc -usepw

the -usepw command option allows the remote user to enter a password to access via VNCViewer. Thus the password that you assign using the vncpasswd command should be use.

Logs generated by the command above when running it on the foregorund.

snip...

raw_fb: (nil)
fake_fb: (nil)

01/10/2007 02:31:54 setting up 32 cursors...
01/10/2007 02:31:54 done.
01/10/2007 02:31:54
01/10/2007 02:31:54 Autoprobing TCP port
01/10/2007 02:31:54 Autoprobing selected port 5900
01/10/2007 02:31:54 Xinerama: disabling: display does not support it.
01/10/2007 02:31:54 created 32 tile_row shm polling images.
01/10/2007 02:31:54 fb read rate: 10 MB/sec
01/10/2007 02:31:54 screen setup finished.
01/10/2007 02:31:54
The VNC desktop is: mandrivadesktop001:0
PORT=5900



Followed by a log when someone made a connection remotely then disconnects.


01/10/2007 02:34:02 Got connection from client 10.10.9.7
01/10/2007 02:34:02 other clients:
01/10/2007 02:34:02 Disabled X server key autorepeat.
01/10/2007 02:34:02 to force back on run: 'xset r on' (3 times)
01/10/2007 02:34:02 created xdamage object: 0x3800024
01/10/2007 02:34:02 Client Protocol Version 3.5
01/10/2007 02:34:02 Protocol version sent 3.5, using 3.5
01/10/2007 02:34:06 Pixel format for client 10.10.9.7:
01/10/2007 02:34:06 16 bpp, depth 16, little endian
01/10/2007 02:34:06 true colour: max r 31 g 63 b 31, shift r 11 g 5 b 0
01/10/2007 02:34:06 no translation needed
01/10/2007 02:34:06 rfbProcessClientNormalMessage: ignoring unsupported encoding type zlibhex
01/10/2007 02:34:06 Using compression level 9 for client 10.10.9.7
01/10/2007 02:34:06 Enabling X-style cursor updates for client 10.10.9.7
01/10/2007 02:34:06 Enabling full-color cursor updates for client 10.10.9.7
01/10/2007 02:34:06 Enabling cursor position updates for client 10.10.9.7
01/10/2007 02:34:06 Using image quality level 0 for client 10.10.9.7
01/10/2007 02:34:06 Enabling LastRect protocol extension for client 10.10.9.7
01/10/2007 02:34:06 Enabling NewFBSize protocol extension for client 10.10.9.7
01/10/2007 02:34:06 Using tight encoding for client 10.10.9.7
01/10/2007 02:34:11 client_count: 0
01/10/2007 02:34:11 Restored X server key autorepeat to: 1
01/10/2007 02:34:11 viewer exited.
01/10/2007 02:34:11 deleted 32 tile_row polling images.


Peace!