0) { $_SESSION['SFTP_PORT'] = $port[0]; } elseif (preg_match('/^\s*Port\s+(\d+)$/im', file_get_contents('/etc/ssh/sshd_config'), $matches)) { $_SESSION['SFTP_PORT'] = $matches[1] ?? 22; } else { $_SESSION['SFTP_PORT'] = 22; } } preg_match('/(Hestia SFTP Chroot\nMatch User)(.*)/i', file_get_contents('/etc/ssh/sshd_config'), $matches); $user_list = explode(',', $matches[2]); if (in_array($v_user, $user_list)) { $root = '/'; } else { $root = '/home/'.$v_user; } return new \League\Flysystem\Sftp\SftpAdapter([ 'host' => '127.0.0.1', 'port' => intval($_SESSION['SFTP_PORT']), 'username' => basename($v_user), 'privateKey' => '/home/'.basename($v_user).'/.ssh/hst-filemanager-key', 'root' => $root, 'timeout' => 10, 'directoryPerm' => 0755, ]); }; $dist_config['services']['Filegator\Services\Archiver\ArchiverInterface'] = [ 'handler' => '\Filegator\Services\Archiver\Adapters\HestiaZipArchiver', 'config' => [], ]; $dist_config['services']['Filegator\Services\Auth\AuthInterface'] = [ 'handler' => '\Filegator\Services\Auth\Adapters\HestiaAuth', 'config' => [ 'permissions' => ['read', 'write', 'upload', 'download', 'batchdownload', 'zip'], 'private_repos' => false, ], ]; $dist_config['services']['Filegator\Services\View\ViewInterface']['config'] = [ 'add_to_head' => ' ', 'add_to_body' => ' ', ]; return $dist_config;