nextcloud / desktop

💻 Desktop sync client for Nextcloud
https://nextcloud.com/install/#install-clients
GNU General Public License v2.0
3.04k stars 798 forks source link

2FA & nextcloudcmd #1779

Open ptman opened 4 years ago

ptman commented 4 years ago

Expected behaviour

nextcloudcmd should work with TFA

Actual behaviour

nextcloudcmd doesn't work with TFA

Steps to reproduce

  1. Enable TFA
  2. run nextcloudcmd
  3. get error

Client configuration

Client version: Nextcloud version 2.6.2-1

Operating system: Debian bullseye

OS language: English

Qt version used by client package (Linux only, see also Settings dialog): 5.12.5

Client package (From Nextcloud or distro) (Linux only): nextcloud-desktop-cmd/testing,now 2.6.2-1

Installation path of client: /usr/bin/nextcloudcmd

Server configuration

Nextcloud version: 17.0.1

Logs

Please use Gist (https://gist.github.com/) or a similar code paster for longer logs.

02-12 16:45:08:356 [ warning nextcloud.sync.networkjob ]:   QNetworkReply::AuthenticationRequiredError "Error transferring https://.../remote.php/webdav/ - server replied: " QVariant(int, 401)
02-12 16:45:08:356 [ info nextcloud.sync.networkjob.lscol ]:    LSCOL of QUrl("https://.../remote.php/webdav/") FINISHED WITH STATUS "AuthenticationRequiredError Error transferring https://.../remote.php/webdav/ - server replied: "
02-12 16:45:08:356 [ warning nextcloud.sync.discovery ]:    LSCOL job error "Error transferring https://.../remote.php/webdav/ - server replied: " 401 QNetworkReply::AuthenticationRequiredError
rullzer commented 4 years ago

What is TFA?

rullzer commented 4 years ago

Ah two factor authentication. Well be sure to use an apptoken then. Because your native password will indeed not work.

ptman commented 4 years ago

Excellent. How does one use an apptoken with nextcloudcmd?

ptman commented 4 years ago

Is nextcloudcmd supposed to be usable with apptokens?

edent commented 4 years ago

@ptman I use an app token with nextcloudcmd.

For example

nextcloudcmd -u "admin" -p "ABCD-1234-5678-EFGH" ~/nextcloud/ https://example.com/nextcloud
kohane27 commented 1 year ago

@edent Thank you so much for your reply. I was struggling with it for days and finally figured it out. To elaborate on it:

You can't use your login name and password in nextcloudcmd. To use an app token with nextcloudcmd, go to https://efss.qloud.my/index.php/settings/user/security . Under Devices & sessions, you should see an input field App name. Type your app name to generate email and password. Then use them in your nextcloudcmd to perform a sync:

nextcloudcmd --user 'name@mail.com' --password 'app-token-password' /home/name/Nextcloud/ https://efss.qloud.my/ > /dev/null 2>&1

Cheers!