Import users preserving UID
pdbimport will ignore users where the system UID does not match the UID in the file, in order to prevent this error we can create the users with their original UIDs
This commit is contained in:
parent
ab15aae77d
commit
ad9af475d3
8
samba.sh
8
samba.sh
@ -22,9 +22,11 @@ set -o nounset # Treat unset variables as an error
|
|||||||
# Arguments:
|
# Arguments:
|
||||||
# file) file to import
|
# file) file to import
|
||||||
# Return: user(s) added to container
|
# Return: user(s) added to container
|
||||||
import() { local name file="${2}"
|
import() { local file="$1"
|
||||||
for name in $(cat $file | cut -d: -f1); do
|
for line in $(cat $file | cut -d: -f1,2); do
|
||||||
useradd "$name" -M
|
local user=$(echo $line | cut -d: -f1)
|
||||||
|
local uid=$(echo $line | cut -d: -f2)
|
||||||
|
useradd "$user" -u "$uid" -M
|
||||||
done
|
done
|
||||||
pdbedit -i smbpasswd:$file
|
pdbedit -i smbpasswd:$file
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user