X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Date: Fri, 30 Nov 2007 00:11:00 -0500
From: Christopher Faylor <cgf-use-the-mailinglist-please@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: root privileges
Message-ID: <20071130051100.GC21620@ednor.casa.cgf.cx>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <49223.200.158.224.232.1196366961.squirrel@mail2.icmc.usp.br> <50092.200.158.224.232.1196380473.squirrel@mail2.icmc.usp.br>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <50092.200.158.224.232.1196380473.squirrel@mail2.icmc.usp.br>
User-Agent: Mutt/1.5.16 (2007-06-09)
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Thu, Nov 29, 2007 at 09:54:33PM -0200, Jorge Marques Pelizzoni wrote:
>First of all, please believe that I spent almost three hours going through
>the mailing list archives before asking this. It's just that I (and many
>others) have not been able to find a solution there.
>
>I'm not running a program that tests for rootness in some non-portable
>way. I'm just calling an innocent ioctl directly into cygwin, which tells
>me I need more permissions. Just for clarification, here is the problem
>code:
>
>ioctl(fd,TIOCMGET,&status);
>status &= ~TIOCM_RTS;
>ioctl(fd, TIOCMSET, &status); // returns -EPERM
>
>Apart from having a privileged (administrator) windows account, should I
>understand (from http://cygwin.com/cygwin-ug-net/ntsec.html) that all
>cygwin asks for is that I should get things right in /etc/passwd and
>/etc/group?
>
>Please take a look at what I've tried so far:
>
>in /etc/passwd:
>
>  (original)
>jorge:*:1008:513:Jorge,U-QUICKSILVER\jorge,S-1-5-21-1450639292-781126914-3756273746-1008:/home/jorge:/bin/bash
>  (1st try) 
>jorge:*:1008:544:Jorge,U-QUICKSILVER\jorge,S-1-5-21-1450639292-781126914-3756273746-1008:/home/jorge:/bin/bash
>  (2nd try) 
>jorge:*:100:0:Jorge,U-QUICKSILVER\jorge,S-1-5-21-1450639292-781126914-3756273746-1008:/home/jorge:/bin/bash
>  (3rd try) 
>jorge:*:0:0:Jorge,U-QUICKSILVER\jorge,S-1-5-21-1450639292-781126914-3756273746-1008:/home/jorge:/bin/bash
>
>in /etc/group (for the 2nd and 3rd tries above, I added the following line):
>  root:S-1-5-32-544:0:
>
>Finally, I even tried running the program from a "SYSTEM-owned shell", to
>no avail.
>
>Thanks in advance for any pointers. Cheers,

There is never a case where Cygwin sets errno which implies that you
need "root privileges".  You may need more privileges in the Windows sense
but you don't need to specify root in your /etc/passwd to get the job
done.

Cygwin maps to EPERM from two different Windows errors:  ERROR_CANNOT_MAKE
and ERROR_NOT_OWNER.  I don't know which of these is causing your problems
but maybe that will give you a clue about what is going wrong.

And, as a last resort, there's always the option of looking at the Cygwin
source code.

cgf

--
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/

