File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
install/deb/filemanager/filegator Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ All notable changes to this project will be documented in this file.
1818- Set "default" when WEB_TEMPLATE and PROXY_TEMPLATE is missing in user.conf
1919- Add BACKEND_TEMPLATE to default package
2020- Fix possible error occur for v-rebuild-cron-jobs #1943 (thanks @clarkchentw )
21+ - Restrict access Filemanager when SSH is enabled for the user
2122
2223## [ 1.4.3] - Service release
2324
Original file line number Diff line number Diff line change 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 ]);
You can’t perform that action at this time.
0 commit comments