Hi, I’m new to Nextcloud, I’m trying to disable “Access through untrusted domain” but I can’t seem to find a way to. I was able to disable it before (I have no idea how I did it) but I disabled and re-enabled SSL and now it is back. I installed using snap so not to sure if I can edit the files (I was reading about people saying they were read only) I pasted
sudo nextcloud.occ config:system:set trusted_domains 1 --value=192.168.1.* and it seemed to have disabled the untusted domain page but it is no longer working. Is there a fix for this?
The command still works to disable the untrusted domain page on NC13.0.4. For some reason, your installation is nice enough to make occ part of the shell for the account nextcloud.occ. The command was general, and would not work copy pasted. This might:
sudo nextcloud.occ config:system:get trusted_domains
This is what I understand: You ran that other command from your first post you found to make disable the untrusted domain prompt. You changed ssl configs for some reason, then it prompts for authorized domain. Did you try the first command again?
Hi, thanks for the reply. I’m pretty new to linux so I don’t know how to get the logs for Nextcloud. when I do “
occ config:system:get trusted_domains” this is the output "
No command 'occ' found, but there are 20 similar ones occ: command not found root1@ubuntu:~$:"
I accidentally replied by editing my post. Please see it again.
I did try the command again and nothing seemed to change. But, for some reason when I added the ip 192.168.1.* it disabled the untrusted domain page. But it no longer works.
This is what turns up when I run the command
That looks like it should.
The logs are probably the only way to determine the next course of action. I am not familiar with your installation method, but I’ll give it one shot. First attempt to access the server, verifying it shows the unwanted verify domain prompt, then run tail -n 20 followed by the file name returned by this command:
When I run tail -n 20 it seems to “break” the terminal I have to logout and log back in to get it to come back.
Yes, it should be followed by the filename. Pressing control-c would have worked to stop the command too. I see the locate command returned nothing.
Example of another way, since this is more sure to work:
Command: sudo nextcloud.occ config:system:get datadirectory
Add /nextcloud.log to get the command
Command: tail /var/www/nextcloud/data/nextcloud.log
I’m not sure if I am doing something wrong
Your sudo command was right. The tail command needs to have the specific output from the command because I don’t know where it is to tell you right off the bat.
Alright, I’ll give it a go.
It just shows alot of stuff now
moteAddr":“IP Address”,“user”:"–",“app”:“core”,“method”:“GET”,“url”:"/",“message”:“Trusted domain error. “IP” tried to access using “IP” as host.”,“userAgent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36”,“version”:“220.127.116.11”}
I think I get it. You want to disable the authorized domain for every possible value? There are probably good reasons not to do that, but simply replacing the IP address with a star in the command you put in the first post would work. I tested it.
When I do that I don’t think it works, also, it wont let me delete the other IPs that I have
I just tested a command like this would work:
sudo nextcloud.occ config:system:set trusted_domains 1 --value=*
When I run the :get trusted_domains command, it shows the star. I put a random host name in /etc/hosts for the server IP, accessed it by the name, and it didn’t complain. I then removed * from trusted domains and it complained normally.
Doing this is pretty unnecessary, and lets your server resources be used without your consent for whatever doesn’t require authorization.
To delete all your trusted domains at once, run:
sudo nextcloud.occ config:system:set trusted_domains
Hmm, this makes more sense but I didn’t try:
sudo nextcloud.occ config:system:delete trusted_domains
That will delete all your trusted domains at once. All of them, for real.
Well, I want to be able to access it whenever I’m not on my wifi, like my data connection (I believe the IP for that always changes) also I have to login with my username and password anyway. When I ran the clear domains command and then the star domain it added it but no change. Do I need to restart the server?
No, it seems to be consulted for every request. You need to run the command with the star exactly as written. Can you paste what you ran?
On my system, this will replace all trusted domains with *; here’s the text output.
root@andy-virtual-machine:/var/www/nextcloud# sudo -u www-data ./occ config:system:delete trusted_domains
System config value trusted_domains deleted
root@andy-virtual-machine:/var/www/nextcloud# sudo -u www-data ./occ config:system:set trusted_domains 0 --value=*
System config value trusted_domains => 0 set to string *
root@andy-virtual-machine:/var/www/nextcloud# sudo -u www-data ./occ config:system:get trusted_domains
The command with the star has to be done in that certain way that has “–value=*” or else.
The trusted domain is about the name you call the nextcloud server, nothing necessary about IP addresses of either the client or server. For the client, it doesn’t matter. Im going to assume the server is running at home on a mostly static IP.
You can use a free dynamic dns service to give your server a domain name, and that’s the only, single, trusted domain you need. Or you might need to access it from wifi from its ip address, which would make it require only two trusted domains total. But most routers will make it work without having to do that.
Heres what I did root1@ubuntu:~$ sudo nextcloud.occ config:system:set trusted_domains 1 --value=*System config value trusted_domains => 1 set to string *
root1@ubuntu:~$ sudo nextcloud.occ config:system:get trusted_domains