Ben Biddington

Whatever it is, it's not about "coding"

Posts Tagged ‘windows

SSH, cygwin and domain users

leave a comment »

Yes you can log in to your local computer via ssh with a domain account.

If it seems you can’t (i.e., your password is rejected) then you  most likely need to export your user accounts and groups so cygwin can see them.

Another clue that you need to export is if you get a message like:

Your group is currently "mkpasswd".  This indicates that
the /etc/passwd (and possibly /etc/group) files should be rebuilt.
See the man pages for mkpasswd and mkgroup then, for example, run
mkpasswd -l [-d] > /etc/passwd
mkgroup  -l [-d] > /etc/group
Note that the -d switch is necessary for domain users.

To export domain users:

$ mkpasswd -d >> /etc/passwd

To export groups:

$ mkgroup > /etc/group

Troubleshooting

Errors logging in as domain user

2 [main] -bash 31884 C:\cygwin\bin\bash.exe: *** fatal error - couldn't dynamically determine load address for 'WSAGetLastError' (handle 0xFFFFFFFF), Win32 error 126
Connection to localhost closed.

This is because the cygwin sshd service must also run as domain account. I solved this by changing the user to my domain account.

Written by benbiddington

4 August, 2010 at 13:37

FTP command line fu

with one comment

The Windows FTP utility can be easily automated, but if you want to record the output from a session it appears you need to do things in a particular way.

Redirection

It appears this does not work as expected, i.e. you can’t redirect stdout from an interactive ftp session to local file. It creates the file but with nothing in it.

Solution is to run ftp with the -s option which specifies a file containing the full list of commands to be run (including log-in).

> ftp -s:commands.txt > out/result.txt

Where your commands list looks like this example that prints the contents of a directory called phils_lunchbox :

open host_or_ip_address port
username
Password
cd phils_lunchbox
ls -l
quit
Done.

Tips

  • Don’t forget to add the quit or bye command at the end otherwise your command line’ll hang

References

Written by benbiddington

3 August, 2010 at 13:37

Posted in development

Tagged with , , ,

Windows services and net use

leave a comment »

We have some Windows services that need to access network shares, and even though we have net used, those resources are still unavailable. It appears this is because our services are running as LocalSystem.

How to check the connections available to LocalSystem

1. Open command prompt as LocalSystem

Follow these instructions to get a LocalSystem cmd prompt using at.exe.

Note: You can use at.exe only when the Schedule service is running, to find out:

sc query schedule

2. List connections

net use

You will see the set of connections available.

Note this set is different to the list generated by ordinary command prompt (your account).

How to add connection for LocalSystem

Don’t know, that method is not very automatable.

References

Written by benbiddington

27 April, 2010 at 13:37

Posted in development

Tagged with , , , , ,

Passing cucumber specs on windows

leave a comment »

I had some trouble getting cucumber test features to pass on Windows due to directory separator differences, something like:
 Failing Scenarios:
-cucumber features/background/failing_background.feature:8 # Scenario: failing background
+cucumber features\background\failing_background.feature:8 # Scenario: failing background
There is an easy solution — run features with windows_mri profile, which results in the CUCUMBER_FORWARD_SLASH_PATHS environment variable being set to true.

Example

cucumber features/background.feature:93 -p windows_mri

Written by benbiddington

20 April, 2010 at 13:37

Posted in development

Tagged with , , ,