Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have (finally) got sshd working under cygwin on Win7 - well, sort of.

The sshd runs as user 'cyg_server'. I'm able to successfully ssh to my computer using that same user name.

However, if I attempt to ssh using my normal (Windows) user name, it fails trying to allocate a pty for my login session. For example, output of 'sshd -D -d -d -d' contains this

debug1: Entering interactive session for SSH2.
debug2: fd 4 setting O_NONBLOCK
debug2: fd 5 setting O_NONBLOCK
debug1: server_init_dispatch_20
debug1: server_input_channel_open: ctype session rchan 0 win 1048576 max 16384
debug1: input_session_request
debug1: channel 0: new [server-session]
debug2: session_new: allocate (allocated 0 max 10)
debug3: session_unused: session id 0 unused
debug1: session_new: session 0
debug1: session_open: channel 0
debug1: session_open: session 0: link with channel 0
debug1: server_input_channel_open: confirm session
debug1: server_input_global_request: rtype no-more-sessions@openssh.com want_reply 0
debug1: server_input_channel_req: channel 0 request pty-req reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req pty-req
debug1: Allocating pty.
debug1: session_pty_req: session 0 alloc /dev/pty1

!!! chown(/dev/pty1, 17308, 10513) failed: Invalid argument

debug1: do_cleanup
debug1: session_pty_cleanup: session 0 release /dev/pty1

Currently /dev is owned by my normal account. I've tried changing its ownership to cyg_server as well as SYSTEM. In both cases the problem persists. I've also changed permissions for /dev (e.g, 700 and 777) - again problem persists.

[As a side note - it is strange that whenever I do 'ls -al /dev' the ptys do not show up. However, if I 'ls -l /dev/ptyX' for a pty I know to exist, it shows up. Is that normal for cygwin?]

share|improve this question
add comment

1 Answer

Deleting all the /etc/ssh* files and re-running ssh-host-config in a cygwin window opened as administrator fixed the problem for me, I assume by correcting permissions.

I had to do a fair amount of checking and correcting before I was able to get this working:

  • The /etc/ssh* key files are owned, readable and writable by the privileged server account (eg cyg_server)
  • /dev is owner by my (administrator) user account and rwxable by administrators, users and sshd's user
  • The service has been restarted
  • You have set the environment variables CYGWIN=ntsec
share|improve this answer
    
Thanks .. I'll try it. In the meantime I've simply been doing without sshd. –  user115851 May 1 '12 at 18:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.