Wednesday, January 26, 2011

CentOS: Did the RPM create a user?

I'm using CentOS 5.5.

I installed the mysql-server RPM from CentOS.org. I believe this RPM was supposed to create a user called 'mysql'. However, this user doesn't exist.

How can I view the contents of an RPM to see if it attempts to create a user or group?

  • To view scripts in a RPM run:

    rpm -q --scripts $INSTALLEDPACKAGE

    To answer your question: yes, mysql-server creates the mysql user.

    [user@server CentOS]# rpm -qp --scripts mysql-server-5.0.77-4.el5_4.2.i386.rpm
    warning: mysql-server-5.0.77-4.el5_4.2.i386.rpm: V3 DSA signature: NOKEY, key ID e8562897
    preinstall scriptlet (using /bin/sh):
    /usr/sbin/useradd -M -o -r -d /var/lib/mysql -s /bin/bash \
            -c "MySQL Server" -u 27 mysql > /dev/null 2>&1 || :
    postinstall scriptlet (using /bin/sh):
    if [ $1 = 1 ]; then
        /sbin/chkconfig --add mysqld
    fi
    /bin/chmod 0755 /var/lib/mysql
    /bin/touch /var/log/mysqld.log
    preuninstall scriptlet (using /bin/sh):
    if [ $1 = 0 ]; then
        /sbin/chkconfig --del mysqld
    fi
    postuninstall scriptlet (using /bin/sh):
    if [ $1 -ge 1 ]; then
        /sbin/service mysqld condrestart >/dev/null 2>&1 || :
    fi
    
    Stefan Lasiewski : Thanks. Bonus question: I don't see a line which modifies /etc/group . How can I tell what package added 'mysql' to /etc/group ?
    Stefan Lasiewski : I'll answer my bonus question. If no group is specified, then `useradd` will create a group by default. From `man useradd`: "The version provided with Red Hat Linux will create a group for each user added to the system by default"
    From Warner

0 comments:

Post a Comment