This is the mail archive of the
cygwin-apps@cygwin.com
mailing list for the Cygwin project.
Re: [RFC] Globally creating a user and a group "root"
- From: Corinna Vinschen <vinschen at redhat dot com>
- To: "'cygwin-apps at cygwin dot com'" <cygwin-apps at cygwin dot com>
- Date: Thu, 27 Nov 2003 15:28:30 +0100
- Subject: Re: [RFC] Globally creating a user and a group "root"
- References: <CCD084B0E779D411A70300508B66222605A330E5@exchukahis02.experian.co.uk>
- Reply-to: cygwin-apps at cygwin dot com
On Thu, Nov 27, 2003 at 01:24:15PM -0000, Morrison, John wrote:
> OK, took some lunch time ;)
>
> Hows this for passwd-grp.sh
>
> -------------------------------------
>
> #!/bin/sh
>
> if [ ! -e /etc/passwd -a ! -L /etc/passwd ] ; then
> /bin/mkpasswd -l -c > /etc/passwd
> fi
>
> if [ ! -e /etc/group -a ! -L /etc/group ] ; then
> /bin/mkgroup -l -c > /etc/group
> fi
>
> cp -f /etc/passwd ~/passwd.mkpasswd && \
> ( [ -w /etc/passwd ] || chmod --silent a+w /etc/passwd ; ) && \
> sed -e '/:S-1-1-0:/d' ~/passwd.passwd > /etc/passwd && \
> chmod --silent --reference=/etc/group /etc/passwd
> rm -f ~/passwd.mkpasswd
>
> cp -f /etc/group ~/group.mkgroup && \
> ( [ -w /etc/group ] || chmod --silent a+w /etc/group ; ) && \
> echo "root:S-1-5-32-544:0:" > /etc/group && \
> sed -e '/:S-1-1-0:/d' ~/group.mkgroup > /etc/group && \
> chmod --silent --reference=/etc/passwd /etc/group
> rm -f ~/group.mkgroup
>
> -------------------------------------
>
> comments? (I tried to make it play nice with file
> permissions)
Cool! Just the `echo "root:..."' should only be called if the
group file doesn't already contain that entry. As I said, the
upcoming mkgroup will create this entry already (with -l). You
should check its existence first.
Thanks,
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Developer mailto:cygwin@cygwin.com
Red Hat, Inc.