This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Trouble running Perl script that require root privilege


Hello,

Note:  This is NOT a Perl question.

I use Cygwin ocassionally on my WIN2K workstation to develop and run Perl
scripts that I use for network testing.  I have one script that uses the
Net::Ping module that I'm having some trouble with because it fails saying
it requires root privilege as shown below.

	icmp ping requires root privilege at ./sd_ping.pl line 48

Examination of the module reveals that all it's looking for is an effective
UID of 0 (and the OS is not VMS).

	croak("icmp ping requires root privilege") if ($> and $^O ne 'VMS');

I can remove this line from the module and then my script works, but I'd
rather not hack the module.  It seems like I should be able to establish the
correct EUID by changing the ownership of the script to UID 0 and setting
the setuid bit.  But chown doesn't seem to do anything.  It doesn't
complain, it just doesn't change the ownership.  I am trying to do this
logged into WIN2K with my domain account which is part of the administrators
group.  My passwd and group files were created with mkpasswd -l >
/etc/passwd and mkgroup -l > /etc/group.  

Then I thought I could create a root user as below and use login to become
root.

root:*:0:0:Administrators group,S-1-5-32-544:/:/bin/bash

But login fails to authenticate me if I enter 

	login root

and give my domain password.

Then I tried taking the Administrator passwd file entry created by mkpasswd
and replaced the UID and GID generated by mkpasswd with 0:0.  Login still
failed to authenticate me.

Just to see if login works at all I created another local user using Windows
Computer Management and then reran mkpasswd -l.  Then I tried to login as
that user.  No go.  Still failed to authenticate.  What am I missing here?

As a last resort I changed the UID:GID fields in my password file entry
associated with my domain account to 0:0.  Since that's the account I'm
logged into when I start a cygwin session, that should set my UID correctly.
My script works in this environment, but now every time I start a cygwin
shell I'm running as 0:0 which may have other side effects.  

Any suggestions on how to handle this cleanly would be appreciated.  I'm
running WIN2K-SP2 and cygwin-1.1.8-2

Thanks.

--Dave

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]