SHIFT

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


Sidebar

Sponsor:

Would you like to sponsor this site?
Or buy me a beer?:


Recently Changed Pages:

View All Pages
View All Q Pages


View All Tags


Sign up for Q to post comments.





WIKI Disclaimer: As with most other things on the Internet, the content on this wiki is not supported. It was contributed by me and is published “as is”. It has worked for me, and might work for you.
Also note that any view or statement expressed anywhere on this site are strictly mine and not the opinions or views of my employer.


Terms And Conditions for Q users


Pages with comments

PageDateDiscussionTags
2019/05/01 14:08 2 Comments
2019/03/15 16:02 1 Comment
2019/03/15 16:02 1 Comment
2019/03/15 16:02 3 Comments
2017/04/20 15:28 1 Comment
2017/04/20 15:23 1 Comment
2017/04/19 14:44 1 Comment
2017/04/17 20:10 1 Comment
2017/04/17 20:07 1 Comment
2017/04/17 19:58 1 Comment
2017/04/17 19:52 1 Comment

View All Comments

fixcygwinlisteningsockets

Fix: Cygwin: Cannot establish any listening sockets

Or: How to gain ownership of a locked file from another user!

We encounter this message sometimes when an user doesn't close it's X-Server correctly on a Windows Server 2008 Terminal Server (although I thing it will happen on other versions of Windows as well). It actually means there are locked files on the filesystem to ensure there are no two sessions at the same time on the same port. These files are found in the tmp directory under the cygwin installation root, which is by default at C:\Cygwin:

C:\cygwin\tmp>dir
 Volume in drive C has no label.
 Volume Serial Number is 98D6-2DE4

 Directory of C:\cygwin\tmp

16-02-2011  09:39    <DIR>          .
16-02-2011  09:39    <DIR>          ..
19-01-2011  12:42                11 .X0-lock
19-01-2011  12:42    <DIR>          .X11-unix
               1 File(s)             11 bytes
               3 Dir(s)  21.463.330.816 bytes free
C:\cygwin\tmp>cd .X11-unix
C:\cygwin\tmp\.X11-unix>dir /a
 Volume in drive C has no label.
 Volume Serial Number is 98D6-2DE4

 Directory of C:\cygwin\tmp\.X11-unix

19-01-2011  12:42    <DIR>          .
19-01-2011  12:42    <DIR>          ..
19-01-2011  12:42                54 X0
               1 File(s)             54 bytes
               2 Dir(s)  21.462.609.920 bytes free

If you try to delete the files you'll get a permissions error:

C:\cygwin\tmp>del .X0-lock
C:\cygwin\tmp\.X0-lock
Access is denied.

Solution

Normally we ask the user who left the files to restart his session and close it again properly. However, we had one time that the user already left the team which left us with the challenge on how to delete the locked files. This is how we did it:

Step One: Gain Ownership

  • Log in as an (AD) administrative user
  • Select the file and open the properties
  • Go to the 'Security' tab
  • Click on the 'Advanced' button
  • Go to the 'Owner' tab
  • Click the 'Edit' button
  • Select the user you logged in with and click 'OK'
  • You now have to close all windows before you can make any changes

Step Two: Set Permissions

  • Open the properties of the file again
  • Go to the 'Security' tab
  • Click the 'Edit' button
  • Click the 'Add' button
  • Enter the name of the user you logged in with, let the system check for the name and click 'OK'
  • Select the use you added and click the 'Allow' checkbox for 'Full Control' and click 'OK'
  • Again close all windows before you can delete the file

Step Three: Delete The File

  • Make sure only the file you want to delete is selected and press 'Delete'
You could leave a comment if you were logged in.
fixcygwinlisteningsockets.txt · Last modified: 2013/04/21 09:47 by sjoerd