Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP4
shadow
useradd.local
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File useradd.local of Package shadow
#!/bin/sh # # Here you can add your own stuff, that should be done for every user who # was new created. # # When you create a user with useradd, this script will be called # with the login name as parameter. Optional, UID, GID and the HOME # directory are added. # case "$1" in --help|--version) echo Usage: $0 username [uid gid home] exit 0 ;; esac # Check for the required argument. if [ $# -lt 1 -o $# -gt 4 ]; then echo Usage: $0 username [uid gid home] exit 1 fi USER=$1 if [ $# -eq 4 ]; then GID=$3 HOMEDIR=$4 else GID=$(id -g $USER) HOMEDIR=$(grep -E "^${USER}:" /etc/passwd| cut -d: -f6,6) fi # Update NIS database # make -C /var/yp # Main useradd tool creates this if specified on command line [ -d $HOMEDIR ] || exit 0 # If SELinux is enabled, we have to run restorecon to assign # appropriate fcontexts to the respective $HOME and files under it if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled ; then test -x /sbin/restorecon || exit 2 /sbin/restorecon -R $HOMEDIR fi # All done. exit 0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor