Skip to content

Commit

Permalink
Fix for additional accounts on Ubuntu and Debian
Browse files Browse the repository at this point in the history
  • Loading branch information
serghey-rodin committed Oct 12, 2013
1 parent 845e5f9 commit aace12f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
11 changes: 5 additions & 6 deletions bin/v-add-web-domain-ftp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if [ ! -z "$check_ftp_user" ] && [ "$FTP_USER" != "$ftp_user" ]; then
fi

if [ ! -z "$FTP_USER" ]; then
/usr/sbin/userdel -f $FTP_USER
/usr/sbin/userdel -f $FTP_USER > /dev/null 2>&1
fi

# Define shell
Expand All @@ -62,12 +62,11 @@ if [ -e "/usr/bin/rssh" ]; then
fi

# Adding user
/usr/sbin/adduser -o -u $(id -u $user) \
-g $user \
/usr/sbin/useradd $ftp_user \
-s $shell \
-M -d "$HOMEDIR/$user/web/$domain" \
$ftp_user > /dev/null 2>&1

-o -u $(id -u $user) \
-g $user \
-M -d "$HOMEDIR/$user/web/$domain" > /dev/null 2>&1
echo "$ftp_user:$ftp_password" | /usr/sbin/chpasswd
ftp_md5="$(awk -v user=$ftp_user -F : 'user == $1 {print $2}' /etc/shadow)"

Expand Down
11 changes: 9 additions & 2 deletions func/rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,15 @@ rebuild_web_domain_conf() {
# Checking ftp
if [ ! -z "$FTP_USER" ]; then
if [ -z "$(grep ^$FTP_USER: /etc/passwd)" ]; then
/usr/sbin/adduser -o -u $(id -u $user) -g $user -s /sbin/nologin \
-M -d "$HOMEDIR/$user/web/$domain" $FTP_USER > /dev/null 2>&1
shell='/sbin/nologin'
if [ -e "/usr/bin/rssh" ]; then
shell='/usr/bin/rssh'
fi
/usr/sbin/useradd $FTP_USER \
-s $shell \
-o -u $(id -u $user) \
-g $user \
-M -d "$HOMEDIR/$user/web/$domain" > /dev/null 2>&1

# Update password
shadow=$(grep "^$FTP_USER:" /etc/shadow)
Expand Down

0 comments on commit aace12f

Please sign in to comment.