gluon-core: add function to add users

This commit is contained in:
Matthias Schiffer 2014-01-14 18:19:51 +01:00
parent f7cb80e7f8
commit cfa49b30c0
1 changed files with 12 additions and 0 deletions

View File

@ -0,0 +1,12 @@
add_user() {
local username="$1"
local id="$2"
[ "$username" -a "$id" ] || return 1
sed -i "/^$username:/d" /etc/passwd
sed -i "/^$username:/d" /etc/shadow
echo "$username:*:$id:100:$username:/var:/bin/false" >> /etc/passwd
echo "$username:*:0:0:99999:7:::" >> /etc/shadow
}