Skip to content

Commit be3a7bd

Browse files
Improve port detection filemanager (hestiacp#2245)
* Improve port detection filemanager * Adjust spaces Co-authored-by: Raphael Schneeberger <rs@scit.ch>
1 parent 635aa34 commit be3a7bd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

install/deb/filemanager/filegator/configuration.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@
2727

2828
if (!isset($_SESSION['SFTP_PORT'])) {
2929
exec("sudo /usr/local/hestia/bin/v-list-sys-sshd-port json", $output, $result);
30-
if ($output) {
31-
$port=json_decode(implode('', $output));
30+
$port=json_decode(implode('', $output));
31+
if ( is_numeric($port[0]) && $port[0] > 0 ){
3232
$_SESSION['SFTP_PORT'] = $port[0];
33+
} else if ( preg_match('/^\s*Port\s+(\d+)$/im', file_get_contents('/etc/ssh/sshd_config'), $matches) ) {
34+
$_SESSION['SFTP_PORT'] = $matches[1] ?? 22;
3335
} else {
3436
$_SESSION['SFTP_PORT'] = 22;
3537
}

0 commit comments

Comments
 (0)