Shellcheck pass on add_account in ftpadmin
Simple variable quoting and more modern shell constructs.
This commit is contained in:
parent
e97ddd8be0
commit
66c2c8ab35
|
@ -87,18 +87,17 @@ add_account() {
|
||||||
passwd=$4
|
passwd=$4
|
||||||
|
|
||||||
cmd="{if (\$3==$user_id) print \$4}"
|
cmd="{if (\$3==$user_id) print \$4}"
|
||||||
user_gid=`awk -F : "$cmd" /etc/passwd`
|
user_gid="$(awk -F : "$cmd" /etc/passwd)"
|
||||||
|
|
||||||
# Si le répoertoire de travail du compte FTP n'existe pas, on le crée
|
# Si le répertoire de travail du compte FTP n'existe pas, on le crée
|
||||||
if [ ! -d "$path" ]; then
|
if [[ ! -d "$path" ]]; then
|
||||||
mkdir -p $path
|
mkdir -p "$path"
|
||||||
chown $user_id:$user_gid $path
|
chown "$user_id":"$user_gid" "$path"
|
||||||
# fix by tmartin : s/655/755/
|
# fix by tmartin : s/655/755/
|
||||||
chmod 755 $path
|
chmod 755 "$path"
|
||||||
setfacl -R -d -m 'o:rX' $path
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo `echo $passwd | ftpasswd --passwd --file=$VPASSWD_PATH --name=$account_name --uid=$user_id --gid=$user_gid --home=$path --shell=/bin/false --stdin`
|
echo "$passwd" | ftpasswd --passwd --file=$VPASSWD_PATH --name="$account_name" --uid="$user_id" --gid="$user_gid" --home="$path" --shell=/bin/false --stdin
|
||||||
log_msg "Creation du compte $account_name (uid=$user_id, gid=$user_gid, home=$path)"
|
log_msg "Creation du compte $account_name (uid=$user_id, gid=$user_gid, home=$path)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue