Link to home
Start Free TrialLog in
Avatar of toooki
toooki

asked on

cygwin ssh localhost does not work

I installed Cygwin on my Windows 7 PC and installed ssh and rsync components as instructed at http://hadoop.apache.org/docs/r0.20.2/quickstart.html#Supported+Platforms .

Now the command ssh localhost does not work. It returns "Connection closed by 127.0.0.1" almost right away.

I tried to run it and it ended in these errors:

WM2094@WM2094-01 /var
$ pwd
/var
$ ls -l
total 4
drwxr-xr-x+ 1 WM2094 Domain Users 0 Nov 10 00:22 cache
drwx------+ 1 SYSTEM root         0 Nov 10 13:41 empty
drwxr-xr-x+ 1 WM2094 Domain Users 0 Nov 10 13:41 lib
drwxrwxrwx+ 1 WM2094 Domain Users 0 Nov 13 12:26 log
drwxrwxrwx+ 1 WM2094 Domain Users 0 Nov 13 12:18 run
drwxrwxrwt+ 1 WM2094 Domain Users 0 Nov 10 16:32 tmp
$ /usr/sbin/sshd
/var/empty must be owned by root and not group or world-writable.
$ ssh localhost
Connection closed by 127.0.0.1

Is there any way to make the sshd working? But it was working before (few days ago) when I could ssh localhost. Any suggestion will be very helpful. Thank you.
ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of skullnobrains
skullnobrains

in your example, the owner or /var/empty is SYSTEM instead of root

fix that and your sshd server will probably run

chown root:root /var/empty
chmod 500 /var/empty
Avatar of toooki

ASKER

Thank you.

$ getfacl /var/empty
# file: /var/empty
# owner: SYSTEM
# group: root
user::r-x
group::---
mask:rwx
other:---
default:user::rwx
default:group::r-x
default:other:r-x

$ chown root:root /var/empty
chown: invalid user: `root:root'

$ chown root /var/empty
chown: invalid user: `root'


I could not change the ownership to root. It seems there is no root user in cygwin.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Within Cygwin there is /etc/passwd
Did you run the mkpasswd and mkgrup commands after the install?
That should create what you need.
Avatar of toooki

ASKER

Thanks a lot. It seems it was not doable.

I reinstalled Cygwin.
Followed instructions at http://cygwin.com/faq/faq-nochunks.html#faq.setup.uninstall-all
and http://alans.se/blog/2010/hadoop-hbase-cygwin-windows-7-x64/#cygwin

now the /var directory looks like:
WM2094@WM2094-01 /var
$ ls -l
total 0
drwxr-xr-x+ 1 WM2094     Domain Users 0 Nov 14 12:17 cache
drwxr-xr-x+ 1 cyg_server root         0 Nov 14 12:56 empty
drwxr-xr-x+ 1 WM2094     Domain Users 0 Nov 14 12:19 lib
drwxrwxrwx+ 1 WM2094     Domain Users 0 Nov 14 13:16 log
drwxrwxrwx+ 1 WM2094     Domain Users 0 Nov 14 13:16 run
drwxrwxrwt+ 1 WM2094     Domain Users 0 Nov 14 12:16 tmp

and I tried
$ssh localhost
and it worked.
actually, they setup cyg_server as the root account with id 0

glad to see you got a working solution

like above mentioned, do not forget to run mkpass and mkgroup when you add or remove windows users. make sure that your cyg_server user does not disapear in the process.