gluon-core: add function to add users
This commit is contained in:
parent
f99767fb9f
commit
3275c92f72
12
package/gluon-core/files/lib/gluon/functions/users.sh
Normal file
12
package/gluon-core/files/lib/gluon/functions/users.sh
Normal 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user