This post was last updated on July 9th, 2020 at 04:21 pm
Cygwin ssh (OpenSSH), and Win98 – Use “crypt newpassword” to add a password into /etc/passwd
Cygwin is a UNIX environment, developed by Red Hat, for Windows. It consists of two parts:
- A DLL (cygwin1.dll) which acts as a UNIX emulation layer providing substantial UNIX API functionality.
- A collection of tools, ported from UNIX, which provide UNIX/Linux look and feel.
The Cygwin DLL works with all non-beta, non “release candidate”, ix86 versions of Windows since Windows 95, with the exception of Windows CE.
Benefits – Here’s why I like and use Cygwin:
Lots and lots of GNU and FSF software
- Bash Shell
- SSH – openssh
- XFree86 – X-Windows Server for Microsoft Windows
and the list goes on and on. The key thing to note here is that these utilities for the most part come from the same place that the corresponding Linux utilities come from — this means that they will be functionally very similar. So, for example, the ssh is the full version of SSH that does port forwarding and you can transfer files with (sshcopy.html)
Also you get a few server services as will such as SSHD and Apache.
I highly recommend that if you have to use windows and you need to connect to Unix/Linux that you install and use Cygwin, it makes life a lot easier.
- Install cygwin
- configure ssh server as a startup service (from cygwin run ssh-host-config, then go check out startup services in the normal fashion)
- Install VNC
- Configure VNC as a startup service
- You may need to configure the sshd service to retry 3 times (on the recovery tab)
- Then you should be able to ssh to your windows box
- You should also be able to use vncviewer to connect to your box’s desktop (GUI)
- If you want to transfer files to/from Windows you can use SSH
tar -cf – filename | ssh [email protected] “(cd destdir && tar -xvf -)”
- You can make VNC secure by using SSH:
At a separate prompt run something like:
ssh -L 5902:localhost:5900 [email protected]
ssh -C -L 5902:localhost:5900 [email protected]
Then use vncviewer to connect to display #2
If you get a response of:
VNC server supports protocol version 3.3 (viewer 3.3)
VNC connection failed: Local loop-back connections are disabled.
Then that means you need to add a DWORD key to your registry:
run regedit and browse to HKEY_LOCAL_MACHINE\SOFTWARE\ORL\WinVNC3 and
add a DWORD of:
Value for this key is 1
Note that this is not added to the existing “default” section which
has lots of entries.
- In Cygwin, to access your drives, you use something like:
VNC, ssh, zoneedit.com
Setting up VNC and cygwin to be securely accessed.
For this computer you want to access via VNC but securely via SSH, do the following:
Install Cygwin: I suggest most of the following it is a baseline that worked for me:
admin: cron, cygrunsvr
base: all items
editors: ed, vim
interpreters: expat, expect, gawk, perl, python
net: autossh, openssh, rsync
system: chkconfig, initscripts, man, sysvinit
text: enscript, expat, groff, less
utils: bc, bzip2, clear, cygutils, file, patch, pcre
web: links, lynx, wget
x11: xstartmenuicons, xstartupscripts, fvwm, xorg-x11-base xorg-x11-bin xorg-x11-bindlls xorg-x11-binindir xorg-x11-etc xorg-x11-fenc xorg-x11-fnts xorg-x11-libs-data xorg-x11-xwin xorg-x11-xterm
Now set up ssh:
priv sep: yes
net start sshd
cp sshd_config sshd_config.new
:wq (save and exit)
mv sshd_config sshd_config.old
mv sshd_config.new sshd_config
ls -ltr sshd_config*
chown SYSTEM sshd_config
Now set up cron for your zoneedit updater:
Take your ip detection script which gets your firewall’s ip address
and put it in /scripts
*/15 * * * * /scripts/myipscript.sh
(save and exit is :wq)
cygrunsrv -I cron -p /usr/sbin/cron -a -D
net start cron
Also after reboot check that sshd is started (ssh localhost) and make sure your cron is running.
Make sure if you have a firewall on your internet connection (hardware firewall appliance) that you forward 22 to this computer. It is also advisable that your firewall hand you a “fixed ip address” so that your computer doesn’t move around.
If you have a local firewall on your Windows then you will need to allow inbout ssh connections:
Either choose to allow c:\cygwin\usr\sbin\sshd.exe or choose to allow port 22.
To Windows/Cygwin directly:
ssh -N -L 9999:localhost:5900 [email protected]
Unrelated – To Windows via Linux gateway:
ssn -N -L 9998:192.168.0.10:5900 [email protected]
Win98 and ssh, you must use “crypt” to set your user’s password in /etc/passwd.
Just run “crypt newpassword”.
I added the cron and ssh services in regedit for Win98:
I tried adding the paths to AppPath, but that didn’t seem to work:
We wound up doing the following copies from Bash, I couldn’t figure out how to set up the path:
cp -a /bin/cygwin1.dll /cygdrive/c/windows
cp -a /bin/cygcrypt-0.dll /cygdrive/c/windows
cp -a /bin/cygcrypto-0.9.7.dll /cygdrive/c/windows
cp -a /bin/cygz.dll /cygdrive/c/windows
So on Win98 we did successfully get cron and sshd (from Cygwin) running in “RunServices”.
Had to copy over 4 dlls into c:\windows to get sshd working.
Had to use “crypt newpassword” to populate the password field in /etc/password for the ssh user(s).
Was able to use ssh -N -L 9999:localhost:5900 [email protected] to set up a tunnel (from both Linux and Windows).
Was able to follow that ssh command with “vncviewer :9999” (from both Linux and Windows) to gain access to the
Windows desktop securely.
Win98 Setup instructions for secure remote access via ssh and vnc:
- Install VNC server
- Configure VNC to start as a service, set a password
- Install Cygwin including cron (Admin), OpenSSH (Net), and ssmtp (Mail)
- In regedit add cron and sshd to RunOnce:
- cron “c:\cygwin\usr\sbin\cron.exe”
- sshd “c:\cygwin\usr\sbin\sshd.exe”
- cp -a /bin/cygwin1.dll /cygdrive/c/windows
- cp -a /bin/cygcrypt-0.dll /cygdrive/c/windows
- cp -a /bin/cygcrypto-0.9.7.dll /cygdrive/c/windows
- cp -a /bin/cygz.dll /cygdrive/c/windows
- crypt newpasswd >> /etc/passwd
- write /etc/passwd
Secure client access to the above Win98 configuration
From windows you must add vncviewer and OpenSSH from Cygwin.
Linux already has OpenSSH and usually has vncviewer.
From either of the above configurations (Windows or Linux), do the following 2 separate steps in order:
- ssh -N -L 9999:localhost:5900 [email protected] (this will appear to hang, just minimize this window)
- vncviewer :9999
To quote the cygwin site:
You might also like
This post was last updated on July 9th, 2020 at 05:21 pmSimilar to wget-ftp-index.html Need to get a directory listing for a web site which is presented like an ftp
This post was last updated on July 9th, 2020 at 04:57 pm Filename Date Size Title Description ifconfig.html 2005 Jul 07 – 10:06:46 3330 ext-rename.html 2005 Jun 22 – 11:17:09