Browse Source

Merge pull request #2319 from jaapmarcus/fix/2308-ftp-user

Fix bug in v-add-user-sftp
Raphael Schneeberger 4 years ago
parent
commit
681eee0c22
1 changed files with 7 additions and 1 deletions
  1. 7 1
      bin/v-add-user-sftp-jail

+ 7 - 1
bin/v-add-user-sftp-jail

@@ -28,7 +28,13 @@ source_conf "$HESTIA/conf/hestia.conf"
 
 check_args '1' "$#" 'USER'
 is_format_valid 'user'
-is_object_valid 'user' 'USER' "$user" # Limit to only Hestia user(s)
+check=$(is_object_valid 'user' 'USER' "$user")
+if [ $? -ne 0 ]; then 
+    user_str=$(grep "^$user:" /etc/passwd |egrep "rssh|nologin")
+    #try to detect "owner" of the ftp_user if not found dont set it up
+    user=$(echo $user_str | cut -f6 -d : | cut -f3 -d / ) 
+    is_object_valid 'user' 'USER' "$user"
+fi 
 user_str=$(grep "^$user:" /etc/passwd |egrep "rssh|nologin")
 if [ -z "$user_str" ]; then
     exit