Nextcloud command line

From WebarchDocs
Jump to navigation Jump to search

If you have a Nextcloud server or site hosted by Webarchitects you can request SSH access to maintain Nextcloud.

Upgrade

See the CLI instructions.

cd ~/sites/cloud
php updater/updater.phar 

occ

See the ownCloud Console documentation.

You can get a list of the occ commands available like this:

php occ list

Mount using WebDAV on Linux

Mount a remote Nextcloud user account file system using webdav and fstab, these notes are based on these instructions.

sudo apt install davfs2

Add your user account to the dav2fs group (replace $USER with your username):

sudo adduser $USER davfs2

Create directories for the mount point and to store the login details:

mkdir ~/cloud
mkdir ~/.davfs2

Copy, chown and chmod the system secrets:

sudo cp /etc/davfs2/secrets ~/.davfs2/secrets
sudo chown $USER:$USER ~/.davfs2/secrets
sudo chmod 600 ~/.davfs2/secrets

Get a app password for the Nextcloud account and a line at the end of the ~/.davfs2/secrets like this (changing $USER and app-password):

https://cloud.example.com/remote.php/dav/files/$USER/ $USER app-password

Add at the end of /etc/fstab (changing $USER):

https://cloud.example.com/remote.php/dav/files/$USER/ /home/$USER/cloud  davfs  user,rw,auto 0 0

Then, logout of your X11 / Wayland session and login in again (to ensure that the group membership is updated for your environment) and mount the filesystem:

mount ~/cloud

And unmount it:

 umount ~/cloud

You can then use tools such as rsync to update local / remote files and directories.