Jason Pyeron wrote: > When a package needs to verify/add a user, what are the proper ways of > adding users on install and removing them on uninstall? > > This question may be vague, if so my apologies for that. Proper depends upon the distro for which you are packaging. On some distros you would use 'useradd' and on others 'adduser'. So with an equally vague answer, it depends. You have to know your audience. Hints: * Test that the user does not already exist. Create the user if it does not. * How do you handle NIS/YP? Do you care? * Is this a local system user with locally generated ids? Or do they need to be coordinated across systems such as for an NFS user? I suggest looking at any of the other packages that create users and see how they do it. I suggest looking at the source to the sendmail, postfix, named, etc. packages and seeing what techniques they use to create users and to clean up on package erasure. Something like this: %pre if ! grep -q '^myuser:' /etc/group; then groupadd -g 26 myuser 2>/dev/null || true fi if ! grep -q '^myuser:' /etc/passwd; then useradd -u 26 -o -g 26 -c Myuser -d /var/myuser -s /bin/false myuser 2>/dev/null || true fi exit 0 %preun if [ "$1" != 0 ]; then exit 0 fi userdel -r myuser 2>/dev/null || true groupdel myuser 2>/dev/null || true exit 0 Bob