Skip to content

Commit d11806a

Browse files
committed
Restrict access Filemanager users when ssh is enabled
1 parent 5cb8249 commit d11806a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

install/deb/filemanager/filegator/configuration.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,20 @@
3434
}
3535
}
3636

37+
preg_match('/(Hestia SFTP Chroot\nMatch User)(.*)/i', file_get_contents('/etc/ssh/sshd_config'), $matches);
38+
$user_list = explode(',', $matches[2]);
39+
if(in_array($v_user,$user_list)){
40+
$root = '/';
41+
}else{
42+
$root = '/home/'.$v_user;
43+
}
44+
3745
return new \League\Flysystem\Sftp\SftpAdapter([
3846
'host' => '127.0.0.1',
3947
'port' => intval($_SESSION['SFTP_PORT']),
4048
'username' => basename($v_user),
4149
'privateKey' => '/home/'.basename($v_user).'/.ssh/hst-filemanager-key',
42-
'root' => '/',
50+
'root' => $root,
4351
'timeout' => 10,
4452
'directoryPerm' => 0755,
4553
]);

0 commit comments

Comments
 (0)