delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/12/19/12:37:48

X-Spam-Check-By: sourceware.org
Message-ID: <BAY108-F177B194004F1E2041C4024B53F0@phx.gbl>
X-Sender: karlm30 AT hotmail DOT com
In-Reply-To: <20051219121226.GF2965@calimero.vinschen.de>
From: "Karl M" <karlm30 AT hotmail DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: setup/symlinks/gcc/chown question
Date: Mon, 19 Dec 2005 09:37:40 -0800
Mime-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Hi All...

I see the broken links on any machine I use. I run as a restricted user, 
except when I am installing or updating software. Here is the way I do the 
initial install (to prevent permissions leaks)...

define CYGWIN=tty for system

add C:\Cygwin\bin to PATH for system

create C:\Cygwin directory

set C:\Cygwin ownership and full access for administrators
  and disable inheriting permissions from C:\

install Cygwin with setup.exe

.
.
.

Then each time that I update using setup, I have to reset the permissions 
(and mount points-I use system mounts, binary for all except cygdrive, which 
is text). So after running setup each time, I run this script (with no 
services running)

#!/bin/bash

echo Setting up Cygwin mount points
cygwin-mount-points             <<----  This works fine

echo "Globally changing ownership and permissions (except /dev /home /proc)"
cd /
chown administrators.none .
chmod 0755 .
for item in /* ; do
  if [ "$item" != /dev -a "$item" != /proc ]; then
    if [ -d "$item" ]; then
      if [ "$item" != /home ]; then
        chmod -R 0755 "$item" > /dev/null 2>&1
        chown -R administrators.none "$item"
        chmod -R 0555 "$item"            <<---- this is a workaround for the 
symlink problem
        chmod -R 0755 "$item"
      fi
    else
      chown administrators.none "$item"
      chmod 0755 "$item"
    fi
  fi
done

echo Fixing up /etc
rm -f /etc/ssh_host_key
rm -f /etc/ssh_host_key.pub
rm -f /etc/ssh_host_dsa_key
rm -f /etc/ssh_host_dsa_key.pub
chmod 0600 /etc/ssh*
chown system.none /etc/ssh*

echo Fixing up /home
chown administrators.none /home
chmod 0755 /home

echo Fixing up /tmp
chmod 1777 /tmp
rm -fr /tmp/* >/dev/null 2>&1

echo Fixing up /var
chown system.none /var/empty
chmod 1777 /var/log
rm -f /var/log/agent*.log
chmod 0777 /var/log/lastlog
rm -f /var/log/OpenSSH.log
chmod 1777 /var/tmp

I am using the version of setup that is currently on the Cygwin web page.  
Which chmod and which chown report /usr/bin/chmod and /usr/bin/chown 
respectively. For the sequence I reported yesterday, I  was running as 
administrator.

Thanks,

...Karl

>From: Corinna Vinschen Subject: Re: setup/symlinks/gcc/chown question
>Date: Mon, 19 Dec 2005 13:12:26 +0100
>
>On Dec 18 15:51, Karl M wrote:
> > Hi All...
> >
> > It appears to be file permissions related. The link being broken looks 
>like
> > it is because the read only bit on the shortcut file (the .lnk file) is
> > getting turned off. Even though this first getfacl shows write access, 
>the
> > read only box in the windows properties is checked. after the chown -h 
>the
> > windows properties box says not a valid link. After the chmod -R 755, 
>the
> > windows properties shows it as a valid shortcut, but the read only box 
>is
> > unchecked. After a chmod -R 555, the read only box is checked and Cygwin
> > thinks it is a symlink again.
> > [...]
>
>Still, I can't reproduce this.  I tried all variations I could think of,
>but I couldn't break the symlink using Cygwin coreutils chmod and chown
>tools.  The only way I was able to break the symlink was by using the
>native Windows tool "attrib" to reset the readonly bit.
>
>Are you sure you're using Cygwin's chmod/chown?  Did you try to run them
>under strace and see what happens?
>
>
>Corinna
>
>--
>Corinna Vinschen                  Please, send mails regarding Cygwin to
>Cygwin Project Co-Leader          cygwin AT cygwin DOT com
>Red Hat
>
>--
>Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>Problem reports:       http://cygwin.com/problems.html
>Documentation:         http://cygwin.com/docs.html
>FAQ:                   http://cygwin.com/faq/
>



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019