Skip to content

Provide user and password to nextcloudcmd using environment variables #5875

@dvaerum

Description

I have searched for "nextcloudcmd pass" and "nextcloudcmd password" without any luck
https://github.com/nextcloud/desktop/issues?q=is%3Aissue+nextcloudcmd+pass
https://github.com/nextcloud/desktop/issues?q=is%3Aissue+nextcloudcmd+password

Backgroud

When using the "Nextcloud Command Line Client" aka. nextcloudcmd, I have 2 options to declare the username and password needed to authenticate to a Nextcloud server.

  • Interactive mode
  • using the argument --user & --password

I would like to use the nextcloudcmd command in a script without using interactive mode, which means I have to use arguments. But I really don't like that because it leaks username and password, so that any user on the computer can grep it using ps. Here is an example

[user@computer ~]$ while ! ps aux | grep -v grep | grep nextcloudcmd; do sleep 0; done
services 1088791  0.0  0.1 102364 11520 pts/0    R+   23:41   0:00 nextcloudcmd --path /Notes --user test --password secret --exclude /home/services/nextcloud-sync-exclude.list /data/Notes https://nextcloud.example.com

Feature description

So, my feature is to have the option to set user and password through environment variables.

Example if the argument --password isn't provided nextcloudcmd would check if for the environment variable NEXTCLOUD_CLIENT_PASSWORD and if it didn't exist, ask for the password in the using a prompt.

and of course, I would like the same workflow for --user

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions