gluon-core: add function to add users
This commit is contained in:
parent
f7cb80e7f8
commit
cfa49b30c0
|
@ -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
|
||||||
|
}
|
Loading…
Reference in New Issue