SETUP: Server
Install the SSH server:
-
Log into Windows with Administrative privileges
-
If there is no password set for this user, set one in the Control Panel. *(a password is required)
-
Create a cygwin folder in the C: drive (C:\cygwin)
-
Download setup.exe from cygwin.com and save it to C:\cygwin
-
Run C:\cygwin\setup.exe
-
Install from the Internet and save to C:\cygwin\
-
For Local Package Directory, use C:\cygwin\
-
Select a download site from the large list.
-
On the Select Package screen, click View once so “Full” appears.
-
Scroll down to openssh in the package column, and click on “Skip” so an “X” will appear in column “Bin?”.
-
After the packages have been downloaded, finish the installation
-
Right click My Computer, Properties > Advanced > Environment Variables
-
Under System Variables, click New, add CYGWIN as the variable name, add ntsec as the variable value
-
Under System Variables, scroll down to Path, click Edit, add;c:\cygwin\bin to the end of the string already in the field
-
Open Cygwin on the desktop and type in ssh-host-config
-
“Privilege Separation?” Yes
-
“Create local user SSHd?” Yes
-
“Install SSHd as a service?” Yes
-
“CYGWIN = ” enter ntsec
-
While in the same Cygwin window, enter net start sshd to start the SSH server
-
If you ever need to stop the SSH server, enter net stop sshd
-
In the Cygwin window enter mkpasswd –local > /etc/passwd to copy over the Windows user settings to Cygwin
-
In the Cygwin window enter mkgroup –local > /etc/group to copy over the Windows group settings to Cygwin
Test the SSH server:
-
Enter ssh localhost in a Cygwin window
-
Any time you SSH into a server for the first time, you will get an authenticity warning. The RSA key will be listed and it will ask you if you want to continue. Type in ‘yes‘ to continue.
-
If you get a prompt without any errors, enter ls -lh /cygdrive/c
-
If you see a directory listing of your C:\ drive, everything went right
Install the VNC server:
-
Install your VNC client of choice. Make sure you install the server portion of the client
-
If you are given the option to “allow loopback connections” chooseYes
-
Make sure you register the VNC Server as a system service. Various clients do this in different ways
-
Once it’s registered as a service, it will auto-run at Windows startup as a service
Tweak your firewall (if applicable) to allow port 22:
-
In your firewall, open TCP port 22 for SSH use
-
Example: in Norton Internet Security, Personal Firewall > Configure button > Advanced tab > General button > click Add. Permit to and from connections for TCP port 22. Name the rule something like SSH
-
Example: in Windows Firewall for SP2, Start > Control Panel > Windows Firewall > Exceptions Tab > Add port > port name SSH, port 22 TCP
Tweak your router (if applicable) to forward port 22:
-
If you’re behind a router, forward TCP port 22 to your internal IP
-
This means that any traffic coming in through port 22 (the SSH port) will be passed through the router and directed (forwarded) to your internal IP
SETUP: Remote machine
Install the SSH client and create a tunnel:
-
Install your SSH client of choice (mine is PuTTY)
-
Create a tunnel to your SSH server
-
In PuTTY, click the Add button under the tunnels section
-
Make the source port = 5900 and the destination = 127.0.0.1:5900
-
In the SSH Secure Shell client, edit your profile and go to the Tunneling tab
-
Make the listen port 5900, the Destination host 127.0.0.1 and the destination port 5900. Choose TCP for the type and uncheck “Allow local connections only.”
Configure PuTTY for auto-login (if you choose to use PuTTY):
-
Make a shortcut to putty.exe on your Desktop
-
Right click the shortcut, Properties > Shortcut tab > Target field
-
Add the following to the end of the string in the field: -load “[your profile name]” -l [login name] -pw [password]
-
Example: -load “home” -l Mark -pw mypassword
Install the VNC viewer:
-
Find a VNC program of your choice and install the VNC Viewer portion of the package.
EXECUTE: VNC over SSH
-
Open your SSH client, connect to your remote IP address
-
Open your VNC viewer, connect to 127.0.0.1:5900
转载自:
阅读(1500) | 评论(0) | 转发(0) |