Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <20011112154034.90745.qmail@web13806.mail.yahoo.com> Date: Mon, 12 Nov 2001 07:40:34 -0800 (PST) From: Yuri McPhedran Reply-To: y_mcphedran AT yahoo DOT com Subject: 1.3.4-4 Windows 98/ME ssh rsync and inetd setup problem To: cygwin AT cygwin DOT com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Note-from-DJ: This may be spam While I have some Linux and ssh experience, I am new to Cygwin and rsync so I apologize in advance if I am doing something stupid. I've read the documentation, man pages, mailing-list archives etc but to no avail. So far I have successfully installed the full, latest Cygwin package set and have managed to get ssh, sshd, inetd, telnetd etc working fine. Rsync also seems to work when run as "rsync --daemon" called from the command line. What I have *not* been able to do is get rsync to work when called from inetd. I have tried this on two different PCs, one running Windows 98, the other is Windows ME. What follows is a detailed set of step-by-step instructions that I followed. At the very end is my "cygcheck" output. ssh_rsync_inetd_newbie_guide.txt : ------------------------------------------------ Lines starting with a "*" describe actions that you must perform. Lines that start with "$" or "C:\>" are commands that must be typed in exactly as shown. Lines that start with a ":" are the output from the previous entered command. Comments are preceded by "//", and any file listings are placed between two horizontal "-----------------" lines. Here goes... * Download setup.exe from www.cygwin.com into c:\cygwin_tmp * Run setup.exe and "download from the internet" the full package to c:\cygwin_tmp This is about 58Mb so you may want to obtain it elsewhere and/or leave the download running overnight. * Run setup.exe and "install from local directory". Use c:\cygwin_tmp as the "local package directory" and c:\cygwin as the "install root directory". Select default text file type "DOS" and install for "Just Me". Just accept the defaults and keep clicking "next" to install everything. Have the installer create a desktop icon but nothing on the start menu. * At this point you can delete c:\cygwin_tmp - but if it took you a long time to download you might want to keep a copy! * Double-click on the "Cygwin" desktop icon to start a bash command prompt $ mkdir /home/rsync * Use the "id" command to find your username, uid and group. See below. $ id // example output is shown below : uid=500(yuri) gid=544(unknown) groups=544(unknown) $ crypt xxx // where "xxx" is the password that you plan to use for yourself : TsTC6F5Gl4wbk $ crypt yyy // where "yyy" is the password that you plan to use for rsync : tnDbHJapUgqYg * Cut & paste the crypt output into /etc/passwd and edit the file so that there are only two entries... one for your username and one for rsync. You can remove any other entries. It should look something (but *NOT* exactly) like this... -------------------------------------------------- yuri:TsTC6F5Gl4wbk:500:544::/home/yuri:/bin/bash rsync:tnDbHJapUgqYg:501:544::/home/rsync:/bin/bash -------------------------------------------------- * You can use the "login" command to check that the accounts are working correctly. $ iu-config : Creating default /etc/ftpusers file : Creating default /etc/ftpwelcome file : Creating default /etc/inetd.conf file : Creating default /etc/motd file : Creating default /etc/shells file : : Configuration finished. Have fun! $ /usr/sbin/inetd // just minimise & ignore the dos window that appears * You can now test "ftp" and "telnet", if you wish. See below. $ ftp localhost // you will be prompted for a username and password : ftp> quit $ ssh-host-config : Generating /etc/ssh_host_key : Generating /etc/ssh_host_rsa_key : Generating /etc/ssh_host_dsa_key : Generating /etc/ssh_config file : Generating /etc/sshd_config file : Added ssh to /etc/inetd.conf : : Host configuration finished. Have fun! $ ssh-user-config --yes --passphrase "" : Generating /home/yuri/.ssh/identity : Adding to /home/yuri/.ssh/authorized_keys : Generating /home/yuri/.ssh/id_rsa : Adding to /home/yuri/.ssh/authorized_keys2 : Generating /home/yuri/.ssh/id_dsa : Adding to /home/yuri/.ssh/authorized_keys2 : : Configuration finished. Have fun! * It is now possible to start the sshd process from the command line... $ /usr/sbin/sshd // I think it is OK to ignore the following warning... : /etc/sshd_config line 49: Deprecated option CheckMail * Check that the sshd process is running $ ps : PID PPID PGID WINPID TTY UID STIME COMMAND : 694499 1 694499 4294272797 ? 500 11:41:57 /usr/sbin/inetd : 592155 1 592155 4294375141 con 500 11:47:07 /usr/bin/BASH : 721931 1 721931 4294245365 ? 500 11:52:10 /USR/SBIN/SSHD : 765295 592155 765295 4294245593 con 500 11:52:20 /usr/bin/PS * Test ssh access from this (or another) PC. $ ssh localhost // or use a different host name : The authenticity of host 'localhost (127.0.0.1)' can't be established. : RSA key fingerprint is 76:4b:2c:0c:0c:95:f3:b8:3e:a2:1d:18:19:b5:2a:aa. : Are you sure you want to continue connecting (yes/no)? yes : Warning: Permanently added 'localhost' (RSA) to the list of known hosts. : Fanfare!!! : You are successfully logged in to this server!!! * Now we need to configure sshd to be called by inetd. First kill the current inetd and sshd processes, using the PIDs obtained previously using "ps". $ kill -9 694499 721931 * There should now only be a single shell running... $ ps : PID PPID PGID WINPID TTY UID STIME COMMAND : 592155 1 592155 4294375141 con 500 11:47:07 /usr/bin/BASH : 599619 592155 765295 4294245593 con 500 11:52:20 /usr/bin/PS $ cp /usr/sbin/sshd.exe /usr/sbin/in.sshd (??? .exe???) $ vi /etc/inetd.conf * Uncomment the last line in the file and change it to read EXACTLY as follows... ---------------------------------------------------- ssh stream tcp nowait root /usr/sbin/in.sshd sshd -i ---------------------------------------------------- ################################################################################## NOTE: c:\cygwin\usr\doc\Cygwin\openssh-3.0p1.README advises this... ------------------------------------------------------------------------ If starting via inetd, copy sshd to eg. /usr/sbin/in.sshd and add the following line to your inetd.conf file: sshd stream tcp nowait root /usr/sbin/in.sshd sshd -i Moreover you'll have to add the following line to your ${SYSTEMROOT}/system32/drivers/etc/services file: sshd 22/tcp #SSH daemon ------------------------------------------------------------------------ However, using "sshd" in the inetd.conf file does NOT seem to work and the entry in ${SYSTEMROOT}/system32/...services does not seem to make any difference. ################################################################################# * In order to start inetd every time you startup your PC we need to create a batch file that can be called from the Windows "startup" folder. If you are using Windows NT or 2000 it is more elegant to create a "service". This is well documented elsewhere. If you are unable to create a service then this batch file method should still work. There may be a better way to do this but this *does* work for me. * From a regular DOS prompt (NOT BASH!!!) do the following... C:\> copy c:\cygwin\cygwin.bat to c:\cygwin\start_inetd.bat : 1 file(s) copied C:\> notepad c:\cygwin\start_inetd.bat * Change the last line to read as follows... ------------------------------- bash --login -c /usr/sbin/inetd ------------------------------- * Now add c:\cygwin\start_inetd.bat to your windows "startup" menu (via start -> settings -> taskbar & start menu). Either reboot or just run the new batch file. As before, you can minimise and ignore any DOS windows that pop up. * You can now test ssh access from this (or another) machine... $ ssh localhost // or use a different host name : Last login: Sat Nov 10 12:30:25 2001 from localhost : Fanfare!!! : You are successfully logged in to this server!!! * At this stage you may feel that you don't like the inetd DOS window hanging around. There are a number of tools available that will hide windows from the taskbar. One such program that I have looked at is called "WatchCat". It seems that the author's web site ( http://vbourdo.virtualave.net ) is no longer available but the program can be obtained from several places on the web... just do a search with Google. Be warned... hidden windows can cause a PC to "hang" when you try to shut it down! * A shell script to kill all inetd related processes is shown below. You may find it useful if you want to shutdown your PC or just restart inetd after any changes to the /etc/inetd.conf file... ---------------------------------------------------------------------------- #!/bin/sh kill -9 `ps -ef | grep -i "/usr/sbin/in" | awk '{P=P " " $2} END {print P}'` ---------------------------------------------------------------------------- * Now that ssh is working, let's look at rsync. You will first need to create a /etc/rsyncd.conf file something like this... ------------------------- use chroot = false strict modes = false hosts allow = * [rsync] path=/home/rsync/source read only = yes ------------------------- * Next create two directories, /home/rsync/source and /home/rsync/target, then copy some test files into the "source" directory. I used c:\cygwin_tmp\contrib, but at 28Mb you may wish to try something smaller. * Start the rsync daemon from the bash command line, as shown... $ rsync --daemon * Test that rsync is working... $ rsync localhost:: : rsync * Note: at this stage my session always hangs. Hitting CTRL-C a couple of times gets it back. Anybody know why this happens and/or how to fix it??? * Next get a listing of the available files... $ rsync localhost::rsync : drwxr-xr-x 0 2001/11/10 . : drwxr-xr-x 0 2001/11/10 contrib * Great... we are now ready to use rsync to "mirror" the files. $ rsync -auzv localhost::rsync /home/rsync/target * Check that /home/rsync/target contains an exact copy of /home/rsync/source. If you run the same command again it will complete *much* faster, such is the magic of rsync. If you do the test between two different machines the reduction in network traffic will show an even greater improvement. * Now that we have shown that rsync is working we want to get it to use "ssh" instead of the default "rsh", and have it called by inetd. At this point it would be very useful to have a second identically configured PC, but for simplicity I will continue as if you only have access to "localhost" for testing. * Edit the /etc/inetd.conf file and add the following line... ------------------------------------------------------------------- rsync stream tcp nowait root /usr/bin/rsync rsyncd --daemon ------------------------------------------------------------------- * Create a /etc/services file containing just the following line... NOTE: This step does not really seem to be required. ------------- rsync 873/tcp ------------- * Kill any existing "inetd" or "rsync" processes, then restart "inetd". * Now to call rsync via inetd and using ssh... $ rsync -auzv localhost::rsync /home/rsync/target : failed to connect to localhost - Connection refused * Now trying with only one ":" in the command line... $ rsync -auzv localhost:rsync /home/rsync/target : none.none: Permission denied. : unexpected EOF in read_timeout * And now trying to specify the use of "ssh"... $ rsync -auzve ssh localhost:rsync /home/rsync/target : receiving file list ... link_stat rsync : No such file or directory : done : client: nothing to do ################################################################################# * OOPS... what has gone wrong???? I am quite stuck and have checked all the documentation that I can find. Im rather new to Cygwin, ssh and rsync, so perhaps I'm missing something simple. Can you help? * Some newsgroup posts suggest that the "unexpected EOF in read_timeout" can be caused by having a large number of files to transfer. I reduced the number of files to just 5 (instead of the entire "contrib" folder), but got the same error. * Here is a lst of the documentation that I have checked, as well as some useful resources... ################################################################################# * If you get stuck at any stage, there is useful documentation in c:\cygwin\usr\doc, as well as the man pages (try "man ssh", inetd, rsync, and rsyncd.conf). Also try: c:\cygwin\usr\doc\openssh\README c:\cygwin\usr\doc\Cygwin\login.README c:\cygwin\usr\doc\Cygwin\openssh-3.0p1.README c:\cygwin\usr\doc\Cygwin\rsync-2.4.6.README * Resources on the web include... http://www.cygwin.com http://www.cygwin.com/faq/faq_toc.html http://www.cygwin.com/cygwin-ug-net/cygwin-ug-net.html http://cygwin.com/cygwin-ug-net/ntsec.html http://www.openssh.com http://www.openssh.com/faq.html http://tech.erdelynet.com/cygwin-ssh.asp http://rsync.samba.org http://rsync.samba.org/rsync/FAQ.html http://rsync.samba.org/rsync/documentation.html http://optics.ph.unimelb.edu.au/help/rsync/ * Source for WatchCat: ftp://ftp.externet.hu/pub/mirror/sac/utilmisc/wcat200.zip * Source for various system shutdown utilities. http://www.programfiles.com/index.asp?menu2=231 * Source for "MyShutdownFolder" - useful utility that runs programs just prior to system shutdown. Shareware with 30 day trial. $10 to register. ftp://ftp.programfiles.com/13000/MSF15.exe * Source for "TrayIt" - hides items from the taskbar in the system tray. http://www.xmlsp.com/trayit/trayit.htm cygcheck.out : ------------------------------------------------ Cygnus Win95/NT Configuration Diagnostics Current System Time: Sat Nov 10 15:21:34 2001 Win9X Ver 4.90 build 73010104 Path: /usr/local/bin /usr/bin /bin /cygdrive/c/orawin95/bin /cygdrive/c/WINDOWS /cygdrive/c/WINDOWS/COMMAND SysDir: C:\WINDOWS\SYSTEM WinDir: C:\WINDOWS PWD = `/home/yuri' USER = `yuri' MAKE_MODE = `unix' HOME = `/home/yuri' PROMPT = `$p$g' COMSPEC = `C:\WINDOWS\COMMAND.COM ' !C: = `C:\cygwin\bin' CMDLINE = `bash --login -i' HOSTNAME = `SEXTANT' WINDIR = `C:\WINDOWS' WINBOOTDIR = `C:\WINDOWS' PS1 = `\[\033]0;\w\007 \033[32m\]\u@\h \[\033[33m\w\033[0m\] $ ' BLASTER = `A220 I5 D1 T4 P330' MACHTYPE = `i686-pc-cygwin' OLDPWD = `/home/yuri' TEMP = `/cygdrive/c/WINDOWS/TEMP' TMP = `/cygdrive/c/WINDOWS/TEMP' SHLVL = `1' SHELL = `/bin/bash' HOSTTYPE = `i686' OSTYPE = `cygwin' TERM = `cygwin' _ = `/usr/bin/cygcheck' TZ = `GMTST0GMTDT-1,M3.5.0/1,M10.5.0/2' HKEY_CURRENT_USER\Software\Cygnus Solutions HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2 (default) = `/cygdrive' cygdrive flags = 0x00000020 HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2\/ (default) = `C:\cygwin' flags = 0x00000000 HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2\/usr/bin (default) = `C:/cygwin/bin' flags = 0x00000000 HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2\/usr/lib (default) = `C:/cygwin/lib' flags = 0x00000000 HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\Program Options HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2 HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\Program Options a: fd N/A N/A c: hd FAT32 19059Mb 74% CP UN WINME_OLD d: cd N/A N/A e: cd N/A N/A C:\cygwin\bin /usr/bin user textmode C:\cygwin\lib /usr/lib user textmode C:\cygwin / user textmode c: /cygdrive/c user textmode,noumount Found: C:\cygwin\bin\bash.exe Found: C:\cygwin\bin\cat.exe Found: C:\cygwin\bin\cpp.exe Found: C:\cygwin\bin\find.exe Found: c:\WINDOWS\COMMAND\find.exe Warning: C:\cygwin\bin\find.exe hides c:\WINDOWS\COMMAND\find.exe Found: C:\cygwin\bin\gcc.exe Found: C:\cygwin\bin\gdb.exe Found: C:\cygwin\bin\ld.exe Found: C:\cygwin\bin\ls.exe Found: C:\cygwin\bin\make.exe Found: C:\cygwin\bin\sh.exe 56k 2000/12/03 C:\cygwin\bin\cygbz21.0.dll - os=4.0 img=1.0 sys=4.0 "cygbz21.0.dll" v0.0 ts=2000/11/20 23:53 390k 2000/12/05 C:\cygwin\bin\cygtcl80.dll - os=4.0 img=1.0 sys=4.0 "cygtcl80.dll" v0.0 ts=2000/11/26 1:39 5k 2000/12/05 C:\cygwin\bin\cygtclpip80.dll - os=4.0 img=1.0 sys=4.0 10k 2000/12/05 C:\cygwin\bin\cygtclreg80.dll - os=4.0 img=1.0 sys=4.0 "cygtclreg80.dll" v0.0 ts=2000/11/26 1:39 81k 2000/12/05 C:\cygwin\bin\cygitcl30.dll - os=4.0 img=1.0 sys=4.0 "cygitcl30.dll" v0.0 ts=2000/11/26 1:43 35k 2000/12/05 C:\cygwin\bin\cygitk30.dll - os=4.0 img=1.0 sys=4.0 "cygitk30.dll" v0.0 ts=2000/11/26 1:43 623k 2000/12/05 C:\cygwin\bin\cygtk80.dll - os=4.0 img=1.0 sys=4.0 "cygtk80.dll" v0.0 ts=2000/11/26 1:43 18k 2000/10/23 C:\cygwin\bin\cyggdbm.dll - os=4.0 img=1.0 sys=4.0 "cyggdbm.dll" v0.0 ts=2000/10/23 3:26 21k 2001/06/20 C:\cygwin\bin\cygintl.dll - os=4.0 img=1.0 sys=4.0 "cygintl.dll" v0.0 ts=2001/6/20 18:09 45k 2001/07/04 C:\cygwin\bin\cygjbig1.dll - os=4.0 img=1.0 sys=4.0 "cygjbig1.dll" v0.0 ts=2001/7/4 4:25 119k 2001/06/06 C:\cygwin\bin\cygjpeg6b.dll - os=4.0 img=1.0 sys=4.0 "cygjpeg6b.dll" v0.0 ts=2001/6/6 5:27 45k 2001/04/25 C:\cygwin\bin\cygform5.dll - os=4.0 img=1.0 sys=4.0 "cygform5.dll" v0.0 ts=2001/4/25 6:28 26k 2001/04/25 C:\cygwin\bin\cygmenu5.dll - os=4.0 img=1.0 sys=4.0 "cygmenu5.dll" v0.0 ts=2001/4/25 6:27 156k 2001/04/25 C:\cygwin\bin\cygncurses++5.dll - os=4.0 img=1.0 sys=4.0 "cygncurses++5.dll" v0.0 ts=2001/4/25 6:29 226k 2001/04/25 C:\cygwin\bin\cygncurses5.dll - os=4.0 img=1.0 sys=4.0 "cygncurses5.dll" v0.0 ts=2001/4/25 6:17 15k 2001/04/25 C:\cygwin\bin\cygpanel5.dll - os=4.0 img=1.0 sys=4.0 "cygpanel5.dll" v0.0 ts=2001/4/25 6:27 34k 2001/09/30 C:\cygwin\bin\cygform6.dll - os=4.0 img=1.0 sys=4.0 "cygform6.dll" v0.0 ts=2001/9/30 3:43 19k 2001/09/30 C:\cygwin\bin\cygmenu6.dll - os=4.0 img=1.0 sys=4.0 "cygmenu6.dll" v0.0 ts=2001/9/30 3:43 175k 2001/09/30 C:\cygwin\bin\cygncurses++6.dll - os=4.0 img=1.0 sys=4.0 "cygncurses++6.dll" v0.0 ts=2001/9/30 3:45 201k 2001/09/30 C:\cygwin\bin\cygncurses6.dll - os=4.0 img=1.0 sys=4.0 "cygncurses6.dll" v0.0 ts=2001/9/30 3:42 12k 2001/09/30 C:\cygwin\bin\cygpanel6.dll - os=4.0 img=1.0 sys=4.0 "cygpanel6.dll" v0.0 ts=2001/9/30 3:43 163k 2001/05/06 C:\cygwin\bin\cygpng2.dll - os=4.0 img=1.0 sys=4.0 "cygpng2.dll" v0.0 ts=2001/5/6 5:05 17k 2001/06/28 C:\cygwin\bin\cyghistory4.dll - os=4.0 img=1.0 sys=4.0 "cyghistory4.dll" v0.0 ts=2001/1/7 4:34 21k 2001/06/28 C:\cygwin\bin\cyghistory5.dll - os=4.0 img=1.0 sys=4.0 "cyghistory5.dll" v0.0 ts=2001/6/28 3:27 108k 2001/06/28 C:\cygwin\bin\cygreadline4.dll - os=4.0 img=1.0 sys=4.0 "cygreadline4.dll" v0.0 ts=2001/1/7 4:34 135k 2001/06/28 C:\cygwin\bin\cygreadline5.dll - os=4.0 img=1.0 sys=4.0 "cygreadline5.dll" v0.0 ts=2001/6/28 3:27 245k 2001/06/12 C:\cygwin\bin\cygtiff3.dll - os=4.0 img=1.0 sys=4.0 "cygtiff3.dll" v0.0 ts=2001/6/12 18:25 41k 2001/07/04 C:\cygwin\bin\cygXpm-noX4.dll - os=4.0 img=1.0 sys=4.0 "cygXpm-noX4.dll" v0.0 ts=2001/7/4 2:21 45k 2001/07/04 C:\cygwin\bin\cygXpm-X4.dll - os=4.0 img=1.0 sys=4.0 "cygXpm-X4.dll" v0.0 ts=2000/11/20 2:45 49k 2001/02/03 C:\cygwin\bin\cygz.dll - os=4.0 img=1.0 sys=4.0 "cygz.dll" v0.0 ts=2001/2/3 20:35 714k 2001/11/07 C:\cygwin\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0 "cygwin1.dll" v0.0 ts=2001/11/7 18:36 Cygwin DLL version info: dll major: 1003 dll minor: 4 dll epoch: 19 dll bad signal mask: 19005 dll old termios: 5 dll malloc env: 28 api major: 0 api minor: 47 shared data: 3 dll identifier: cygwin1 mount registry: 2 cygnus registry name: Cygnus Solutions cygwin registry name: Cygwin program options name: Program Options cygwin mount registry name: mounts v2 cygdrive flags: cygdrive flags cygdrive prefix: cygdrive prefix cygdrive default prefix: build date: Wed Nov 7 13:36:56 EST 2001 CVS tag: cygwin-1-3-4 shared id: cygwin1S3 Use -h to see help about each section __________________________________________________ Do You Yahoo!? Find a job, post your resume. http://careers.yahoo.com -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/