Add Trusted Domains on Nextcloud on FreeNAS

So I use freeNAS and noticed NextCloud was a plugin recommended for use, so I installed and all is fine, except I need to add a trusted domain for use outside my LAN, but cannot find the config file from within the jails of which FreeNAS installs the plugins.

Is there anyone that is familiar with this type of installation of NextCloud and can they advise.

Thank you all for your time.

Did you try the usual linux tools to search for the config.php such as find or locate? Or ask the FreeNAS community, where the jails of plugins are usually stored.

You can edit /usr/pbi/nextcloud-amd64/www/nextcloud/config/config.php and add your domain or static ip.

I tried to do that but I got a message saying permission denied in the next cloud jail terminal.

How do you log into the jail? I guess you log in with SSH directly into the jail as some user you/the plugin created?

If you log in from the freeNAS system (with sudo jexec # csh), you will be logged in as root and it should work to edit all files.

Well I just use the terminal that free nas gives root@nextcloud_1. I then enter the command line above but get permission denied. So I just insert sudo jexec #csh into the command line? How would I then be able to access configuration php file?

I tried doing what you told me to do but I got an error saying:

The command give you a root shell in the jail from the “main” freenas system.

The # in the command should be exchanged with the jail ID number. You can get it by running


and read the output. Sudo is not neccesary if you run it as root. It should work, at least if you run freeNAS 9.10. I would recommend you to also try and get SSH to work on the freeNAS system. The terminal available from the webgui is a bit slow and buggy to use.

It sound very strange if you get permission denied if you run as root in the nextcloud jail. What permissions does the file have?

I tried accessing the files but permission is denied.

Aha. It seems you are a bit new to using CLI. Try this reading/interactive tutorial to get a grasp of the basics

You need to add some extra commands before the path to the file. Otherwise it will try to run it (which you can’t, since the file is not executable). You will need to use a text editor. vi is included, but it is quite hard to use if you are new to it. Try to install nano, I find it more beginner friendly

Begin by updating the repository

pkg update

Then run

pkg install nano

To install it. Confirm with y. Then when it is done, run

cd /usr/pbi/nextcloud-amd64/www/nextcloud/config/


cp config.php config.php-backup

to create a backup in case you mess it up. If you want to, verify the backup file is there by running



nano config.php

and you will open the file. Edit and close the program with crtl+x, confirm with y again. If it works, remove the backup you created earlier.

Correct I am very new to this but I have had some experience very minimal though. I tried updating the repository but this is what I got. [root@freenas ~]# pkg update
Updating local repository catalogue…
pkg: file:///usr/ports/packages/meta.txz: No such file or directory
repository local has no meta file, using default settings
pkg: file:///usr/ports/packages/packagesite.txz: No such file or directory
Unable to update repository local
[root@freenas ~]#

Hmm. I have never used plugins, they might not allow updates that way to not break them. Try to either just install nano directly, or worst case, try out vi. Change nano with vi when opening the file. Make sure you have a backup first though. If you are new to vi, you will mess it up, and not just once.

Some info to use vi is available here: Vi reference guide

No shame in being new, everybody was at some point :slight_smile:

I typed in nano in the command line and it took me a new window called new buffer. I tried using vi /usr/pbi/nextcloud-amd64/www/nextcloud/config/config.php but it just created a new file. I am bit lost lol. I am running a freenas os in a virtual box on windows 10.

From where are you trying to access the file with that command? If nano creates a new file (or buffer as it will be called), it did not find the file (or you did not specify one). It needs to be run from within the nextcloud jail. If you have done that, try to navigate down the folder tree one level at a time. Use cd to change directory.

  1. Make sure you are in the right jail. The prompt should say root@nextcloud_1

  2. Start going down the directory tree one step at a time to see where the command above fails. Use cd and “tab” to autocomplete. Start writing a directory name and hit tab, it will auto-complete the directory/file name for you

    cd /usr/
    cd pbi/

etc until you are in the config folder and find the config file. You can look what files/directories there after each step with ls -l. When you have found the config file, make a backup and then run. I really want to stress the backup part. If you mess it up (which is easy) without one, you will have to reinstall or rollback the entire jail if you can’t figure out what you did wrong. Back it up with

cp config.php config.php-backup

after you have found it. Then open it with nano

nano config.php

and edit the file. If you still have trouble, try searching for it or consider using the freeNAS forums. They are more knowledgeable about the freeNAS system and might help you to more specifically locate the file for you

Ok, thank you so much your time,help, and knowledge! Do you have a social media account or somewhere I can message you. I don want to blow up this forum.

I did it by click on the jail in freenas and then on the cli icon to open terminal for that jail.

Thank you Durkin. You are right. I did get there and managed to add the domain I wanted to. So thanks.

I know this is a total rookie questions, but I have found the config.php file in the shell, but I do not know how to edit it. Can someone help me with this? please and thank you !