FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 10-15-2008, 03:31 AM
"nate"
 
Default creating a user from an RPM package

Spiro Harvey wrote:

> Alternatively, if you could point me to a package or a spec file that
> does this, I'd be much obliged.

>From the postifx srpm..

%define postfix_uid 89
%define postfix_user postfix
%define postfix_gid 89
%define postfix_group postfix
%define postdrop_group postdrop
%define maildrop_group %{postdrop_group}
%define maildrop_gid %{POSTDROP_GID}
[..]
%pre
# Add user and groups if necessary
%{_sbindir}/groupadd -g %{maildrop_gid} -r %{maildrop_group} 2>/dev/null
%{_sbindir}/groupadd -g %{postfix_gid} -r %{postfix_group} 2>/dev/null
%{_sbindir}/groupadd -g 12 -r mail 2>/dev/null
%{_sbindir}/useradd -d %{postfix_queue_dir} -s /sbin/nologin -g
%{postfix_group} -G mail -M -r -u %{postfix_uid} %{postfix_user} 2>/dev/null
exit 0

--

I don't see anything that removes the user as part of
rpm removal, though you could just use userdel/groupdel.

nate

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-15-2008, 03:38 AM
Ian Forde
 
Default creating a user from an RPM package

On Wed, 2008-10-15 at 16:22 +1300, Spiro Harvey wrote:
> What wizardry do you guys use in the SPEC file when creating/deleting a
> user from an RPM package?
>
> I was going to create a macro like:
>
> %define user(login,uid,gid,name,homedir,shell)
> echo "$1:x:$2:$3:$4:$5:$6" >>/etc/passwd;
> echo "$1:!!:12005:0:99999:7:::" >>/etc/shadow;
> echo "$1:x:$3:" >>/etc/group;
> mkdir -p $5;
> chown $2:$3 $5
>
> and then appropriate sedness and rm's when removing it, but I figure
> there has to be a cleaner way, or a builtin as this surely is a
> common feature. The RPM guide doesn't seem to mention it, or if it
> does, I missed it.
>
> Alternatively, if you could point me to a package or a spec file that
> does this, I'd be much obliged.

You know, you could always use the useradd command...

-I

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-15-2008, 03:58 AM
Spiro Harvey
 
Default creating a user from an RPM package

"nate" <centos@linuxpowered.net> wrote:
> >From the postifx srpm..

thanks. and to you Ian; looks like useradd is the standard way.

clamav uses it too.


--
Spiro Harvey Knossos Networks Ltd
021-295-1923 www.knossos.net.nz

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 06:36 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org