A person installed Nextcloud 16 on an ubuntu 18.04 server for me. I am very new to all this, so I did not understand all that he did. (I am grateful for his help, though.)
I am trying to figure out occ.
-
What do I do so that I can run occ on this server by using the command occ, instead of always typing /var/www/nextcloud/occ?
-
to run an occ command, I always have to type this: sudo -u www-data php varwww/nextcloud/occ command Why do I have to become user www-data? What is the purpose of having the “php” in there? Is it required?
It should run with the same permissions as it runs as php on the webserver. In case in makes modifications to the file system, it is makes sure that the web-application later has no permission problems, furthermore it is better to run scripts with minimal permissions.
Using php
as command makes sure it uses php. You can configure your system that you can directly execute occ
and it recognized php as script language. With the php
command upfront it’s more foolproof and preferred for documentation purposes. Also if you have different php versions installed, you can choose the one you want to use.
put this into your ~/.bashrc
function occ {
sudo -u www-data php /var/www/nextcloud/occ "$@"
}
make sure you source ~/.bashrc
after you edit it. or simply logout and login again.
root@h277xxxx:~# vim .bashrc
root@h277xxxx:~# . .bashrc
root@h277xxxx:~# occ --help
Usage:
list [options] [--] [<namespace>]
Arguments:
namespace The namespace name
Options:
--raw To output raw command list
--format=FORMAT The output format (txt, xml, json, or md) [default: "txt"]
2 Likes