[Bug]: External SFTP storage randomly stops working / login failing
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- Nextcloud Server is running on 64bit capable CPU, PHP and OS.
- I agree to follow Nextcloud's Code of Conduct.
Bug description
I'm trying to connect an external SFTP storage (SSH on Ubuntu 22.04) to my Nextcloud (for backup reasons...). No matter what server or hostname I use, The indicator shows green (~10%) and red (~90%) randomly whenever I test the connection.
I was able to connect to all SFTP via ssh or FileZilla for months without issues so I know they work well and respond fast. I also tried localhost and 127.0.0.1 which never worked.
10% of the time:
90% of the time:
This bug seems to be similar to #31851 (Apr 5, 2022: External SFTP storage randomly stops working), which was closed due to inactivity.
Steps to reproduce
- Enter SFTP connection details and credentials into the form within the external storage app.
- Enter tested and valid SFTP connections.
- Reload the indecator.
Expected behavior
The indicator shows green (~10%) and red (~90%) randomly whenever I test the connection.
I cannot open the external storage under files: The folder gets a red background after some time when clicked.
Installation method
Community Web installer on a VPS or web space
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.1
Web server
Apache (supported)
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
None
Are you using the Nextcloud Server Encryption module?
None
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
{
"system": {
"instanceid": "***REMOVED SENSITIVE VALUE***",
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"***REMOVED SENSITIVE VALUE***"
],
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"dbtype": "mysql",
"version": "25.0.4.1",
"overwrite.cli.url": "***REMOVED SENSITIVE VALUE***",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbport": "",
"dbtableprefix": "oc_",
"mysql.utf8mb4": true,
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"installed": true,
"default_phone_region": "DE",
"default_language": "de_DE",
"default_locale": "de",
"memcache.local": "\\OC\\Memcache\\APCu",
"skeletondirectory": "",
"maintenance": false
}
}
List of activated Apps
Enabled:
- activity: 2.17.0
- backup: 1.2.0
- circles: 25.0.0
- cloud_federation_api: 1.8.0
- cms_pico: 1.0.21
- collectives: 2.3.0
- comments: 1.15.0
- contacts: 5.1.0
- contactsinteraction: 1.6.0
- dashboard: 7.5.0
- dav: 1.24.0
- diary: 0.0.9
- federatedfilesharing: 1.15.0
- federation: 1.15.0
- files: 1.20.1
- files_external: 1.17.0
- files_pdfviewer: 2.6.0
- files_rightclick: 1.4.0
- files_sharing: 1.17.0
- files_trashbin: 1.15.0
- files_versions: 1.18.0
- firstrunwizard: 2.14.0
- groupfolders: 13.1.1
- logreader: 2.10.0
- lookup_server_connector: 1.13.0
- nextcloud_announcements: 1.14.0
- notifications: 2.13.1
- oauth2: 1.13.0
- password_policy: 1.15.0
- photos: 2.0.1
- privacy: 1.9.0
- provisioning_api: 1.15.0
- recommendations: 1.4.0
- related_resources: 1.0.4
- richdocuments: 7.1.2
- richdocumentscode: 22.5.802
- serverinfo: 1.15.0
- settings: 1.7.0
- sharebymail: 1.15.0
- spreed: 15.0.4
- support: 1.8.0
- survey_client: 1.13.0
- systemtags: 1.15.0
- text: 3.6.0
- theming: 2.0.1
- twofactor_backupcodes: 1.14.0
- updatenotification: 1.15.0
- user_status: 1.5.0
- viewer: 1.9.0
- weather_status: 1.5.0
- workflowengine: 2.7.0
Disabled:
- admin_audit
- bruteforcesettings
- encryption
- suspicious_login
- twofactor_totp
- user_ldap
Nextcloud Signing status
No errors have been found.
Nextcloud Logs
This error many times:
files_external Exception: Login failed
/var/www/ncTest/apps/files_external/lib/Lib/Storage/SFTP.php - line 166:
OCA\Files_External\Lib\Storage\SFTP->getConnection()
/var/www/ncTest/apps/files_external/lib/MountConfig.php - line 131:
OCA\Files_External\Lib\Storage\SFTP->test()
/var/www/ncTest/apps/files_external/lib/Controller/StoragesController.php - line 288:
OCA\Files_External\MountConfig::getBackendStatus("*** sensiti ... *")
/var/www/ncTest/apps/files_external/lib/Controller/GlobalStoragesController.php - line 201:
OCA\Files_External\Controller\StoragesController->updateStorageStatus("*** sensiti ... *")
/var/www/ncTest/lib/private/AppFramework/Http/Dispatcher.php - line 225:
OCA\Files_External\Controller\GlobalStoragesController->update("*** sensiti ... *")
/var/www/ncTest/lib/private/AppFramework/Http/Dispatcher.php - line 133:
OC\AppFramework\Http\Dispatcher->executeController()
/var/www/ncTest/lib/private/AppFramework/App.php - line 172:
OC\AppFramework\Http\Dispatcher->dispatch()
/var/www/ncTest/lib/private/Route/Router.php - line 298:
OC\AppFramework\App::main()
/var/www/ncTest/lib/base.php - line 1047:
OC\Route\Router->match()
/var/www/ncTest/index.php - line 36:
OC::handleRequest()
Additional info
The server shows a low CPU and RAM usage throughout testing. php.ini was configured to have more than enough resources available:
max_execution_time = 10800
memory_limit = 512M
post_max_size = 10G
upload_max_filesize = 10G
date.timezone = Europe/Berlin
opcache.enable=1
opcache.memory_consumption=512
opcache.interned_strings_buffer=64
opcache.max_accelerated_files=10000
opcache.revalidate_freq=1
opcache.save_comments=1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with apps/files_external/lib/Storage/SFTP.php at line 166 and trace the logged call through MountConfig.php and the storage controllers. Repeatedly test the valid SFTP connection described in the issue, then verify that the connection indicator and external folder remain reliable rather than failing intermittently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100