This is the mail archive of the
mailing list for the Cygwin project.
Re: Running as root
----- Original Message -----
From: "Igor Peshansky" <email@example.com>
To: "Stephen Grant Brown" <firstname.lastname@example.org>
Sent: Sunday, June 18, 2006 3:56 AM
Subject: Re: Running as root
On Sat, 17 Jun 2006, Stephen Grant Brown wrote:
I want to run backup and restore programs, and also a program which will
tell me which files have changed to make a program stop working.
I would like to run programs as root, which means the userid and group
need to be set to 0, and the name needs to = root.
I have looked through the ntsec.html document and I afraid it is too
complicated for me to understand.
Can somebody explain how to do this to me in a more simplified format
That depends on what you want to do. If you are sure your login account
has enough privileges, and you simply have a program that non-portably
How do I determine if my login account has enoungh priverledges?
I know my default login account of stephen does not have a uid and gid of 0
I cannot login to administrator.
checks whether you're running as root (and you don't have the ability to
properly fix the program), you can read the following section of the above
document: <http://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-sids>. It
The third line of the above reference reads
Both files may now contain SIDs of users and groups. They are saved in the
last field of pw_gecos in /etc/passwd and in the gr_passwd field in
What is a SID?
What is pw_gecos?
Typing "man -a passwd" does not tell the fields in the /etc/passwd
also helps to know that it's ok to have multiple entries in the passwd
file for the same user -- forward lookups by SID find the first entry with
that SID, and reverse lookups by user will find any entry with that
username/userid. So you can simply add an entry for
"root::0:513:YOURSID:...", and make sure it precedes the actual entry for
What is the rest of this "root::0:513:..." line?
your account, and any program checking your effective userid (e.g., "id")
will show you as "root" with UID of 0.
If you really do need to do root'y stuff, e.g., switch user contexts, etc,
then read <http://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-switch> and
Google for "SYSTEM-owned bash shell" to see how to start processes as
SYSTEM (sshd doesn't let you switch to SYSTEM, unfortunately, unless you
use public key authentication, as you normally don't know and have no
control over the password for SYSTEM).
Thanks for your understanding. I am still finding a lot of this advice too
complicated for my simple brain.
Yours Sincerely Stephen Grant Brown
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html