NextcloudCMD without GUI

We will install and configure the Nextcloudclient (nextcloudcmd) 2.3.3 to sync all data headless and without any gui to your or federated Nextcloud Server silently. Therefore we will add the Nextcloud repository as root to your Ubuntu Server, install the Nextcloud client, create a shell script and configure a cronjob to sync your data automatically.

updated: March 21st, 2018:
– added silent and verbose mode to

Let’s start:

sudo -s


add-apt-repository ppa:nextcloud-devs/client


add-apt-repository ppa:nextcloud-devs/client-beta

Then we run “apt update” and instal the Nextcloud Client:

apt update && apt install nextcloud-client

Create a shell script to sync your data:

vi /root/

Paste the following rows:

echo "-------------------------------------"
echo " START: $(date)"
echo "-------------------------------------"
nextcloudcmd -v
echo "-------------------------------------"
echo " NextcloudCMD by C-RIEGER.DE ..."
# silently ("-s"):
nextcloudcmd -u "YourUser" -p "Your-APP-Pass-Word" -s /your/local/path/
# verbose:
# nextcloudcmd -u "YourUser" -p "Your-APP-Pass-Word" /your/local/path/
echo "-------------------------------------"
echo " END: $(date)"
echo "-------------------------------------"
#if you have e.g. postfix enabled, you may receive an email. Remove the '#' before mail -s:
#mail -s "NextcloudCMD" -a "From: Your Name <>"< /home/ubuntuuser/bkup/nccmd.txt
exit 0

Substitute all the red ones properly. Save and quit the file (:wq!) and make the script executable:

chmod +x /root/

Create a cronjob to sync your data @hourly:

crontab -e

Paste the following row:

@hourly /root/ > /home/ubuntuuser/bkup/nccmd.txt 2>&1

Verify, if the sync is working well by running:

/root/ > /home/ubuntuuser/bkup/nccmd.txt 2>&1

You should receive an email that looks like:

START: So 07. Jan 08:02:03 CEST 2018
nextcloudcmd version 2.3.3
/NextcloudCMD by C-RIEGER.DE…
END: So 07. Jan 08:02:07 CEST 2018

From now, all your data will be synced hourly.

Carsten Rieger