Skip to content

Using windows cygwin as a target machine with python test framework

Kevin Normoyle edited this page May 26, 2013 · 1 revision

some quick notes. Apparently the cygwin sshd daemon can be setup to run as a service, even if cygwin isn't running?

If you don't know about putting ip addresses in a file like pytest-config_kevin.json for a multi-machine python test, this info is not useful to you.

If you add user '0xdiag" to a windows box with an existing cygwin install, you have to do some magic incantations to get the user in cygwin. Then you'll want to copy the distributed 0xdiag_rsa to authorized_keys in /home/0xdiag/.ssh

Also remember that the permissions on /home/0xdiag should be 0x755, and 600 on /home/0xdiag/.ssh and all the files in side it. (otherwise ssh might not like it)

If you want to use your own username, then it's probably easiest if all your windows boxes have the same username, and you need to exchange keys (id_rsa.pub/id_rsa same everywhere and id_rsa.pub copied into authorized_keys would be easiest). This is in /home//.ssh in cygwin.

New User in Cygwin

Cygwin does not have useradd or adduser. Instead, you should first create a user in Windows and run some commands in Cygwin to read the user list.

####Create a Windows User Create the user in Windows (Usually Start|Control Panel|Manage User Accounts|Add...)

####Link to the Windows Users You may want to copy /etc/passwd to passwd.old and /etc/group to group.old first in case of problems. After doing the following, try to 'su - ' to make sure everything works before you leave cygwin.

Type mkpasswd -l > /etc/passwd and mkgroup -l > /etc/group to get all of the local users and group synced up.

After that, you should be able to "su - 0xdiag" for instance. You may need to create /home/0xdiag first and then /home/0xdiag/.ssh etc. Remember the permissions issue (see above).

Trying to ssh to a windows machine that has cygwin

I assume after you have usernames sorted out and keys, that you can ssh into the windows machine as a test. Evidently there's work to do to setup cygwin ssh. The link below walks through the steps including what you need as ssh client and server from cygwin setup.

Windows 7:

http://www.howtogeek.com/howto/41560/how-to-get-ssh-command-line-access-to-windows-7-using-cygwin/

Windows XP: (I found this one better. I (kevin) successfully configured sshd on my windows xp 32-bit/cygwin box using this, and was able to ssh into it)

http://publib.boulder.ibm.com/infocenter/tivihelp/v21r1/index.jsp?topic=%2Fcom.ibm.tivoli.tpm.sec.doc%2Fsecurity%2Ftsec_sshxppro.html

###Firewall stuff For Windows XP SP2, you have to tweak the "Windows Firewall" to allow TCP 22 Click Start...Control Panel....Security Centre....Windows Firewall....Exceptions....Add

http://www.lee.org/reading/computers/sshd/cygwin-sshd.html

Clone this wiki locally