How to become root/root (0/0)

Erik Soderquist ErikSoderquist@gmail.com
Wed May 8 14:33:00 GMT 2019


On Wed, May 8, 2019 at 9:50 AM Henning wrote:
>
> In order to not be misunderstood: the question is not about executing
> a single command as a priviledged user.
>
> Instead, I'm asking how to get rid the annoying Unknown+User and
> Unknown+Group  with six digits IDs permanently.

This indicates user lookup is not working for some reason; did you
configure and start the cygserver service?
https://cygwin.com/cygwin-ug-net/ntsec.html

> What I've tried so far:
>
> 1. put USER=root and HOME=/root
>     This gave me only /root as $HOME.
>
> 2. put the USER=root and UID=0 on the starting cmdline like so
>     U:\bin\mintty.exe -d -T tty1 -i /Cygwin-Terminal.ico /bin/env TTY=1
> USER=root UID=0 /bin/bash -il
>     which gave me $UID=0 but not $USER=root
>
> 3. additionally set USER=root in ~/.profile
>     this finally yielded $USER=root

I think you are conflating things...  On Windows, UID 0 does not
exist, and so trying to force UID 0 I would expect to result in less
than guest privileges.

> _but_ to no avail. because echo foo > bar and then ls -{l,n} showed
> that absolutely nothing had changed: USER=Unknown+User (-1) etc.
> And, what's worse, an attempt to chmod user perms of ./bar was not
> possible.
>
> 4. following an old thread (Nov 2003) in the cygwin-apps mailing list
>     I created /etc/passwd with the line
>           root::0:0:me:/root:/bin/bash
<snip>
>
> but again, to no avail. I simply can't get rid of the Unknowen+User
> stuff. (And I am unable to change the user bits of permissions.)

Except for relatively rare corner cases, the use of /etc/passwd in
Cygwin has been deprecated for a long time now.  This might actually
be causing you significant problems now if you are not one of the rare
corner cases.
https://cygwin.com/cygwin-ug-net/ntsec.html

> I forgot to mention that my Windows user name is root, and I am the
> only user, that is, administrator, group administrators. And I have
> switched off UAC (registry) in order to avoid constant annoyances
> regarding permissions.

I certainly understand the feeling here; what I do instead of
disabling UAC is configure sshd and alias 'sudo' to 'ssh localhost';
this way I am not always running everything with the admin tokens.

> What do I have to do, to get root (user and group).

again, conflating; UID/GID 0 does not exist; the nearest equivalent is
running the process(es) with the admin tokens in place.  Trying to
force UID/GID 0 may be what broke this in your environment.

> N.B. My cygwin installation is up to date. Windows 8.1
> I have been using Linux for nearly 25 years (since kernel 1.2/3) and
> cygwin since 2002. So this is not my first cygwin experience, but my
> worst up to now.

I reference https://cygwin.com/cygwin-ug-net/ntsec.html specifically
because you specify your cygwin install is up to date, but you are
using the deprecated /etc/passwd etc. files.

-- Erik

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



More information about the Cygwin mailing list