Skip to content

Commit 4b9cb6e

Browse files
committed
Correct shell setting when SFTP chroot is enabled
1 parent e892898 commit 4b9cb6e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

bin/v-change-user-shell

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,16 @@ is_object_unsuspended 'user' 'USER' "$user"
3636
shell_path=$(grep -w "$shell" /etc/shells | head -n1)
3737

3838
# Changing passwd file
39-
/usr/bin/chsh -s "$shell_path" "$user" &>/dev/null
39+
/usr/bin/chsh -s "$shell_path" "$user" >/dev/null 2>&1
4040
shell=$(basename $shell_path)
4141

4242
# Adding jailed sftp env
4343
if [ ! -z "$SFTPJAIL_KEY" ]; then
44-
$BIN/v-add-user-sftp-jail $user
44+
if [[ "$shell" =~ nologin ]] || [[ "$shell" =~ rssh ]]; then
45+
$BIN/v-add-user-sftp-jail $user >/dev/null 2>&1
46+
else
47+
$BIN/v-delete-user-sftp-jail $user >/dev/null 2>&1
48+
fi
4549
fi
4650

4751

0 commit comments

Comments
 (0)