Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

after trying hard to search for RPM best practices guides and finding virtually none, to my surprise, I resort to the community -

I need to ensure that some users and groups exist after the installation, and that the users are members of the groups. Are there a recommended procedure(s) for this?

In the existing rpm spec I see that the required users&groups are removed at the beginning of the %pre script prior to adding them with useradd. I am told that this is a common practice. Why is this? Is it better then testing for user existence with id -u?

Some of our clients may want to manage their users themselves, so they would create the users before running our rpm. So to sum up all the above, it seems that the best approach is to test for user existence and to create it if does not exist. Any comments on that? Thanks.

EDIT: RHEL 5.7

share|improve this question
4  
What about fedoraproject.org/wiki/Packaging:UsersAndGroups ? It doesn't delete anything –  Ulrich Dangel Dec 23 '12 at 11:13
    
thanks @Ulrich Dangel, I'll have a look but is cross-platform? I am working on RHEL 5.7 –  davka Dec 23 '12 at 11:50
1  
Yes Fedora, RHEL, and CentOS are all cross platform with each other. –  slm Dec 23 '12 at 14:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.