nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.37k stars 4.07k forks source link

Mount External Storage via SFTP and RSA Public Key Failed #2539

Closed bspire closed 4 years ago

bspire commented 7 years ago

Steps to reproduce

  1. Login to nextcloud
  2. Activate App "External Storage Support"
  3. Navigate to Administration -> External Storage
  4. Add external Storage via SFTP, Authentication RSA Public Key
  5. Upload Public RSA Key to Storage Provider (Strato HiDrive in this case)
  6. Fill Configuration of External Storage Provider

Expected behaviour

External Storage gets mounted successfully, LED turns green

Actual behaviour

Failed to mount External Storage, LED turns red

nextcloud Logging shows:

{"reqId":"PoZ0717Ny38xV4t4vcXy","remoteAddr":"91.9.94.160","app":"PHP","message":"Connection closed by server at \/var\/www\/nextcloud\/3rdparty\/phpseclib\/phpseclib\/phpseclib\/Net\/SSH2.php#2324","level":3,"time":"2016-12-06T21:52:58+00:00","method":"PUT","url":"\/index.php\/apps\/files_external\/globalstorages\/4","user":"admin"}
{"reqId":"PoZ0717Ny38xV4t4vcXy","remoteAddr":"91.9.94.160","app":"files_external","message":"Exception: {\"Exception\":\"Exception\",\"Message\":\"Login failed\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/nextcloud\\\/apps\\\/files_external\\\/lib\\\/Lib\\\/Storage\\\/SFTP.php(156): OCA\\\\Files_External\\\\Lib\\\\Storage\\\\SFTP->getConnection()\\n#1 \\\/var\\\/www\\\/nextcloud\\\/apps\\\/files_external\\\/lib\\\/config.php(233): OCA\\\\Files_External\\\\Lib\\\\Storage\\\\SFTP->test(false, true)\\n#2 \\\/var\\\/www\\\/nextcloud\\\/apps\\\/files_external\\\/lib\\\/Controller\\\/StoragesController.php(257): OC_Mount_Config::getBackendStatus('\\\\\\\\OCA\\\\\\\\Files_Exte...', Array, false, true)\\n#3 \\\/var\\\/www\\\/nextcloud\\\/apps\\\/files_external\\\/lib\\\/Controller\\\/GlobalStoragesController.php(179): OCA\\\\Files_External\\\\Controller\\\\StoragesController->updateStorageStatus(Object(OCA\\\\Files_External\\\\Lib\\\\StorageConfig), true)\\n#4 [internal function]: OCA\\\\Files_External\\\\Controller\\\\GlobalStoragesController->update(4, 'strato', 'sftp', 'publickey::rsa', Array, Array, Array, Array, 100, true)\\n#5 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(160): call_user_func_array(Array, Array)\\n#6 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(90): OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController(Object(OCA\\\\Files_External\\\\Controller\\\\GlobalStoragesController), 'update')\\n#7 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/AppFramework\\\/App.php(111): OC\\\\AppFramework\\\\Http\\\\Dispatcher->dispatch(Object(OCA\\\\Files_External\\\\Controller\\\\GlobalStoragesController), 'update')\\n#8 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/AppFramework\\\/Routing\\\/RouteActionHandler.php(47): OC\\\\AppFramework\\\\App::main('GlobalStoragesC...', 'update', Object(OC\\\\AppFramework\\\\DependencyInjection\\\\DIContainer), Array)\\n#9 [internal function]: OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler->__invoke(Array)\\n#10 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/Route\\\/Router.php(293): call_user_func(Object(OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler), Array)\\n#11 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/base.php(983): OC\\\\Route\\\\Router->match('\\\/apps\\\/files_ext...')\\n#12 \\\/var\\\/www\\\/nextcloud\\\/index.php(48): OC::handleRequest()\\n#13 {main}\",\"File\":\"\\\/var\\\/www\\\/nextcloud\\\/apps\\\/files_external\\\/lib\\\/Lib\\\/Storage\\\/SFTP.php\",\"Line\":141}","level":3,"time":"2016-12-06T21:52:58+00:00","method":"PUT","url":"\/index.php\/apps\/files_external\/globalstorages\/4","user":"admin"}

Server configuration

Operating system: Linux Debian 8.6

Web server: Apache 2.4.10

Database: MySQL 5.5.53

PHP version: 5.6.27

Nextcloud version: (see Nextcloud admin page) 10.0.1

Updated from an older Nextcloud/ownCloud or fresh install: Fresh installation

Where did you install Nextcloud from: Linux Commandline

Signing status:

Signing status ``` No errors have been found. ```

List of activated apps:

App list ``` # sudo -u www-data php occ app:list Enabled: - activity: 2.3.2 - bookmarks: 0.9.0 - calendar: 1.4.1 - comments: 1.0.0 - contacts: 1.4.0.0 - dav: 1.0.1 - documents: 0.13.1 - encryption: 1.3.1 - federatedfilesharing: 1.0.1 - federation: 1.0.1 - files: 1.5.2 - files_external: 1.0.2 - files_pdfviewer: 0.8.1 - files_sharing: 1.0.0 - files_texteditor: 2.1 - files_trashbin: 1.0.0 - files_versions: 1.3.0 - files_videoplayer: 0.9.8 - firstrunwizard: 1.1 - gallery: 15.0.0 - mail: 0.6.0 - notifications: 0.3.0 - ownnote: 1.08 - password_policy: 1.0.0 - provisioning_api: 1.0.0 - serverinfo: 1.1.1 - survey_client: 0.1.5 - systemtags: 1.0.2 - tasks: 0.9.3 - theming: 1.0.1 - twofactor_totp: 0.4.1 - updatenotification: 1.0.1 - workflowengine: 1.0.1 Disabled: - admin_audit - external - files_accesscontrol - files_automatedtagging - files_retention - templateeditor - user_external - user_ldap - user_saml ```

The content of config/config.php:

Config report ``` # sudo -u www-data php occ config:list system { "system": { "instanceid": "ocl3bs8zttr2", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "next.vunlox.com" ], "datadirectory": "\/var\/local\/nextcloud\/data", "overwrite.cli.url": "https:\/\/next.vunlox.com", "dbtype": "mysql", "version": "9.1.1.5", "dbname": "nextcloud", "dbhost": "localhost", "dbport": "", "dbtableprefix": "oc_", "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "logtimezone": "UTC", "installed": true, "memcache.local": "\\OC\\Memcache\\APCu", "mail_from_address": "nextcloud", "mail_smtpmode": "php", "mail_domain": "vunlox.com", "maintenance": false, "loglevel": 2 } } ```

Are you using external storage, if yes which one: SFTP with RSA Public Key Authentication

Are you using encryption: no

Are you using an external user-backend, if yes which one: no

Client configuration

Browser: Chrome 55.0.2883.75

Operating system: macOS Sierra 10.12.1

Logs

Web server error log

Web server error log ``` empty ```

Nextcloud log (data/nextcloud.log)

Nextcloud log ``` {"reqId":"ShgsNwhkYk2Vw1iPJrnT","remoteAddr":"91.9.80.212","app":"mysql.setup","message":"Specific user creation failed: An exception occurred while executing 'SELECT user FROM mysql.user WHERE user=?' with params [\"oc_admin\"]:\n\nSQLSTATE[42000]: Syntax error or access violation: 1142 SELECT command denied to user 'nextcloud'@'localhost' for table 'user'","level":3,"time":"2016-11-21T13:18:14+00:00","method":"POST","url":"\/index.php","user":"--"} {"reqId":"ShgsNwhkYk2Vw1iPJrnT","remoteAddr":"91.9.80.212","app":"mysql.setup","message":"Database creation failed: An exception occurred while executing 'GRANT ALL PRIVILEGES ON `nextcloud` . * TO 'nextcloud'':\n\nSQLSTATE[42000]: Syntax error or access violation: 1044 Access denied for user 'nextcloud'@'localhost' to database 'nextcloud'","level":3,"time":"2016-11-21T13:18:14+00:00","method":"POST","url":"\/index.php","user":"--"} ```

Browser log

Browser log ``` empty ```
bspire commented 7 years ago

Link to nextcloud forum discussion:

https://help.nextcloud.com/t/mount-strato-hidrive-external-storage-via-sftp-failed/5798

skjnldsv commented 4 years ago

As the version of the software you've reported this for has reached end of life, I will close this ticket. If this is still happening after an upgrade to the latest version, feel free to reopen