Skip to content

Commit 681eee0

Browse files
authored
Merge pull request hestiacp#2319 from jaapmarcus/fix/2308-ftp-user
Fix bug in v-add-user-sftp
2 parents d7ae9ee + b05c27c commit 681eee0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

bin/v-add-user-sftp-jail

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ source_conf "$HESTIA/conf/hestia.conf"
2828

2929
check_args '1' "$#" 'USER'
3030
is_format_valid 'user'
31-
is_object_valid 'user' 'USER' "$user" # Limit to only Hestia user(s)
31+
check=$(is_object_valid 'user' 'USER' "$user")
32+
if [ $? -ne 0 ]; then
33+
user_str=$(grep "^$user:" /etc/passwd |egrep "rssh|nologin")
34+
#try to detect "owner" of the ftp_user if not found dont set it up
35+
user=$(echo $user_str | cut -f6 -d : | cut -f3 -d / )
36+
is_object_valid 'user' 'USER' "$user"
37+
fi
3238
user_str=$(grep "^$user:" /etc/passwd |egrep "rssh|nologin")
3339
if [ -z "$user_str" ]; then
3440
exit

0 commit comments

Comments
 (0)