3

I have an ubuntu server and a windows XP client running Cygwin. The server ssh's into the client and tries to execute a shell script with some params, with the following command:

ssh user@IP_ADDR 'sh /home/user/project/clientside 2 5 7 6 9 5 7 IP_ADDR'

where IP_ADDR is the IP address of client.
However, while doing so, I get the following error:

Access is denied.

Thinking this might be a user permissions error, I tried running sh /home/user/project/clientside 2 5 7 6 9 5 7 IP_ADDR on the client, on Cygwin, while logged in as user.
This works as expected.

Then I thought that this might be an error with the login that I use when I ssh into the client. So I executed this instead:

ssh user@IP_ADDR 'whoami'

and got back user.

This happened even after I did chmod -R 777 /home/user/project on the client, in Cygwin.

For kicks, I got on Cygwin on the client and did ssh localhost and manually executed sh /home/user/project/clientside 2 5 7 6 9 5 7 IP_ADDR.
This worked as expected.

However, when I did ssh IP_ADDR from Cygwin and did ssh localhost and manually executed sh /home/user/project/clientside 2 5 7 6 9 5 7 IP_ADDR, I get the same Access is denied. error.

Why is this happening? How can I fix this?

By the way, both the server and the client have each other's rsa public key for passwordless ssh

2 Answers2

2

The problem is with they way windows services work.
This fixes the problem:

  1. Close Cygwin
  2. Go to windows services (services.msc on Run Dialog).
  3. Stop the CYGWIN sshd service
  4. Double click on CYGWIN sshd to enter the service properties
  5. Stop the service
  6. Under the Log On tab, ensure that Log on as is set to Local System account and Allow service to interact with desktop is checked
  7. Restart the service
  8. Restart Cygwin
  9. Go get a beer
1

You can try ssh IP_ADDR sh echo lalala to just that indeed you can open an sh terminal. if it fails ... you know the reason. Also it would be helpful to give us a sample of /var/log/messages and /var/log/secure {or whatever log you think that will be useful}

Nikolaidis Fotis
  • 1,994
  • 11
  • 13