NextCloud Client Command Line


I have a headless server - one without a GUI - which I use as a NextCloud client. My laptop, phone, tablet, and server all sync with a cloud-based NextCloud instance.

But, sadly, NextCloud don't offer a way for servers to speak to servers. If you try to run apt install nextcloud it will try to install 300MB of GUI dependencies which you just can't use.

Luckily, there's a way around all that! It's a bit convoluted, so here's a guide.

Download the latest AppImage

Grab the link for the most recent AppImage

On your server:

mkdir nextcloudapp
cd nextcloudapp
wget https://github.com/nextcloud/desktop/releases/download/????.AppImage -O Nextcloud.AppImage

Make it executable:

chmod +x Nextcloud.AppImage

Next, extract it:

./Nextcloud.AppImage --appimage-extract

That will place all the files in squashfs-root/

I moved all the files and folders out of there to a more convenient location.

You may need to install some dependencies:

sudo apt install libgl1 libharfbuzz0b

Finally, you need to export the libraries which were in the app image:

export LD_LIBRARY_PATH=~/nextcloudapp/usr/lib

Running it

I recommend creating an app specific password on your NextCloud admin interface.

You can run NextCloud as a one-off job using:

./nextcloudcmd -u "MyUserName" -p "P4ssw0rd" /path/to/NextCloud/ https://your_online.nextcloud.example/

That will spit out a lot of log files. You can make it run silently with the -s option. Probably best to run it in a tmux.

Make it persistent

Sadly, there's no way to permanently set the LD_LIBRARY_PATH. So you'll need to export the library each time you want to sync.

If only NextCloud offered a headless daemon. Ah well!

Bugs

There is a bug with the CLI version where it won't download files with a colon in the filename.


Share this post on…

  • Mastodon
  • Facebook
  • LinkedIn
  • BlueSky
  • Threads
  • Reddit
  • HackerNews
  • Lobsters
  • WhatsApp
  • Telegram

2 thoughts on “NextCloud Client Command Line”

What are your reckons?

All comments are moderated and may not be published immediately. Your email address will not be published.

Allowed HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <p> <pre> <br> <img src="" alt="" title="" srcset="">