Create system user

From SME Server
Jump to navigationJump to search
PythonIcon.png Skill level: Developer
Risk of inconsistencies with Koozali SME Server methodology, upgrades & functionality is high. One must be knowledgeable about how changes impact their Koozali SME Server. Significant risk of irreversible harm.


Create system user

a routine exists in /sbin/e-smith/ to create easily sytem users (different of user registered in LDAP)

  • usage
#  /sbin/e-smith/create-system-user
Must give username param
Usage: /sbin/e-smith/create-system-user: user userid descr home_dir shell
  • example
/sbin/e-smith/create-system-user dns 53 "Name server" /var/service/tinydns /bin/false
/sbin/e-smith/create-system-user dnslog 411 "DNS log user" /var/log /bin/false
/sbin/e-smith/create-system-user jdownloader 810 "Jdownloader server" /var/lib/jdownloader /bin/bash

Create a user in %prep

that could be done also like this in a spec file or by the command line

%pre
if [ `grep -c ^user /etc/passwd` = "0" ]; then
/usr/sbin/useradd -c 'User Comment' -d /path/to/user/home -p 'encrypted password' -s /bin/bash user
fi

other examples

%pre
....
/usr/sbin/groupadd \
 -g 500 shared 2>/dev/null || :
/usr/sbin/useradd \
 -u 102 -c 'e-smith web server' -d /home/e-smith \
 -G shared -M -s /bin/false www 2>/dev/null || :
/usr/sbin/useradd \
 -u 101 -c 'e-smith administrator' -d /home/e-smith \
 -G shared,root,www -M -s /sbin/e-smith/console admin 2>/dev/null || :
/usr/sbin/useradd \
 -u 103 -c 'e-smith guest' -d /home/e-smith \
 -G shared -M -s /bin/false public 2>/dev/null || :
/usr/sbin/useradd \
 -u 1002 -c 'sme log user' -d /var/log/smelog \
 -M -s /bin/false smelog 2>/dev/null || :