• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Issue Write permission on webserver

stefan-franz

Basic Pleskian
Hello, i tried to make on putty: (V-Server on Strato, Ubunto 18.04, Plesk Newest Update:
But i don't have write access - how can i switch temporarily on/on?

root@h2937523:/var/www/vhosts/stefan-franz.de/nextcloud# sudo -u www-data php occ db:add-missing-indices
Cannot write into "config" directory!
This can usually be fixed by giving the webserver write access to the config directory.

The Reason for it is in my Nextcloud:

The database is missing some indexes. Due to the fact that adding indexes on big tables could take some time they were not added automatically. By running "occ db:add-missing-indices" those missing indexes could be added manually while the instance keeps running. Once the indexes are added queries to those tables are usually much faster.
  • Missing index "fs_id_storage_size" in table "oc_filecache".
  • Missing index "fs_storage_path_prefix" in table "oc_filecache".
  • Missing index "properties_pathonly_index" in table "oc_properties".
  • Missing index "job_lastcheck_reserved" in table "oc_jobs".
 
Permissions are normally set with the "chmod" command. Maybe you can first check what the current permissions on the directory are, like
# ll /var/www/vhosts/stefan-franz.de/nextcloud/config
Then you might change them like this:
# chmod 0644 /var/www/vhosts/stefan-franz.de/nextcloud/config
 
Permissions are normally set with the "chmod" command. Maybe you can first check what the current permissions on the directory are, like
# ll /var/www/vhosts/stefan-franz.de/nextcloud/config
Then you might change them like this:
# chmod 0644 /var/www/vhosts/stefan-franz.de/nextcloud/config


root@h2937523:~# ll /var/www/vhosts/stefan-franz.de/nextcloud/config
insgesamt 84
drwxr-xr-x 2 stefan-franz psacln 4096 Mär 29 08:05 ./
drwxr-x--- 15 stefan-franz psaserv 4096 Mär 29 06:13 ../
-rw-r----- 1 stefan-franz psacln 1416 Mär 29 08:05 config.php
-rw-r--r-- 1 stefan-franz psacln 66350 Mär 21 13:02 config.sample.php
-rw-r--r-- 1 stefan-franz psacln 495 Mär 21 13:02 .htaccess
root@h2937523:~#

Do you think, i need to adjust here anything as you wrote above? I think i have read and write rights?

In the Nextcloud forum there is this hint:
All of the directorys and files /var/www/vhosts/stefan-franz.de/nextcloud must be owned from www-data.

From root:
chown -R www-data:www-data /var/www/vhosts/stefan-franz.de/nextcloud
(on your own risk)

Read manual:
man chown

But i' not shure if i should change the owner.....i'm afraid to crash Nextcloud.....

Anyone who know here what i can do?
 
-rw-r----- 1 stefan-franz psacln 1416 Mär 29 08:05 config.php

means that only admin has read and write access, the group has only read access. You need to at least update this to 0640, -rw-rw----.
 
Mayday....help

After that changing i have a inter Server Error. How can i go back to the original rights?

Nextcloud is broken!

Interner Serverfehler​

Der Server konnte die Anfrage nicht fertig stellen.

Sollte dies erneut auftreten, sende bitte die nachfolgenden technischen Einzelheiten an Deinen Server-Administrator.

Weitere Details können im Server-Protokoll gefunden werden.

Technische Details​

 
Changing permissions on config.php to 0644 cannot possible cause that. What is logged in your error_log?
 
Mayday....help

After that changing i have a inter Server Error. How can i go back to the original rights?

Nextcloud is broken!

Interner Serverfehler​

Der Server konnte die Anfrage nicht fertig stellen.

Sollte dies erneut auftreten, sende bitte die nachfolgenden technischen Einzelheiten an Deinen Server-Administrator.

Weitere Details können im Server-Protokoll gefunden werden.

Technische Details​

Changing permissions on config.php to 0644 cannot possible cause that. What is logged in your error_log?
Adfter the 0644:
drw-r--r-- 2 stefan-franz psacln 4096 Mär 29 08:05 ./
drwxr-x--- 15 stefan-franz psaserv 4096 Mär 29 06:13 ../
-rw-r----- 1 stefan-franz psacln 1416 Mär 29 08:05 config.php
-rw-r--r-- 1 stefan-franz psacln 66350 Mär 21 13:02 config.sample.php
-rw-r--r-- 1 stefan-franz psacln 495 Mär 21 13:02 .htaccess
root@h2937523:/var/www/vhosts/stefan-franz.de/nextcloud#

Before:
drwxr-xr-x 2 stefan-franz psacln 4096 Mär 29 08:05 ./
drwxr-x--- 15 stefan-franz psaserv 4096 Mär 29 06:13 ../
-rw-r----- 1 stefan-franz psacln 1416 Mär 29 08:05 config.php
-rw-r--r-- 1 stefan-franz psacln 66350 Mär 21 13:02 config.sample.php
-rw-r--r-- 1 stefan-franz psacln 495 Mär 21 13:02 .htaccess

Please help me with the command to get back
 
The difference between
drw-r--r-- 2 stefan-franz psacln 4096 Mär 29 08:05 ./
and
drwxr-xr-x 2 stefan-franz psacln 4096 Mär 29 08:05 ./
is that you applied the command to the directory, not the file. You can change the directory back to 0755 by running
# chmod 0755 <your directory>
 
You must change the file permissions of the config.php file so that occ can edit that file. The problem is that there you only have read permissions for the webserver. That is why I mentioned to set 0644 to the config.php file.
 
What is the correct command for the config.php

now it looks so:
drwxr-xr-x 2 stefan-franz psacln 4096 Mär 29 08:05 ./
drwxr-x--- 15 stefan-franz psaserv 4096 Mär 29 06:13 ../
-rw-r----- 1 stefan-franz psacln 1416 Mär 29 08:05 config.php
-rw-r--r-- 1 stefan-franz psacln 66350 Mär 21 13:02 config.sample.php
-rw-r--r-- 1 stefan-franz psacln 495 Mär 21 13:02 .htaccess
root@h2937523:/var/www/vhosts/stefan-franz.de/nextcloud/config#
 
Do you meant that?
chmod 0644 /var/www/vhosts/stefan-franz.de/nextcloud/config/config.php

And if yes, what would be the command to switch back?
 
To set -rw-rw----
# chmod 0660 /var/www/vhosts/stefan-franz.de/nextcloud/config/config.php
To set -rw-r-----
# chmod 0640 /var/www/vhosts/stefan-franz.de/nextcloud/config/config.php

Have you considered reading the man page for chmod or resources on the internet on file permissions? I think you could benefit from a more thorough basis when you want to operate Nextcloud.
 
root@h2937523:~# chmod 0660 /var/www/vhosts/stefan-franz.de/nextcloud/config/config.php
root@h2937523:~# cd /var/www/vhosts/stefan-franz.de/nextcloud
root@h2937523:/var/www/vhosts/stefan-franz.de/nextcloud# sudo -u www-data php occ db:add-missing-in dices
Cannot write into "config" directory!
This can usually be fixed by giving the webserver write access to the config directory.

But, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it.
See Configuration Parameters — Nextcloud latest Administration Manual latest documentation
 
root@h2937523:/var/www/vhosts/stefan-franz.de/nextcloud# chmod 0775 /var/www/vhosts/stefan-franz.de/nextcloud/config
root@h2937523:/var/www/vhosts/stefan-franz.de/nextcloud# sudo -u www-data php occ db:add-missing-indices
Cannot write into "config" directory!
This can usually be fixed by giving the webserver write access to the config directory.

No write access
 
root@h2937523:/var/www/vhosts/stefan-franz.de/nextcloud# chmod 0775 /var/www/vhosts/stefan-franz.de/nextcloud/config
root@h2937523:/var/www/vhosts/stefan-franz.de/nextcloud# sudo -u www-data php occ db:add-missing-indices
Cannot write into "config" directory!
This can usually be fixed by giving the webserver write access to the config directory.

No write access
Yes of course not.

now it looks so:
drwxr-xr-x 2 stefan-franz psacln 4096 Mär 29 08:05 ./
Do you see that the directory does only allow read access for the server? It says
drwx r-x r-x
The second group "r-x" is missing the "w". If you want the server to write to this directory, you have to change the permission on the directory, too. Like chmod 0775.

You could really benefit from some studying. It does not make sense to get "solutions" here for basic Linux knowledge, because next time with a similar issue you'll need support again. But these things are basic Linux knowledge.
 
Yes of course not.


Do you see that the directory does only allow read access for the server? It says
drwx r-x r-x
The second group "r-x" is missing the "w". If you want the server to write to this directory, you have to change the permission on the directory, too. Like chmod 0775.

You could really benefit from some studying. It does not make sense to get "solutions" here for basic Linux knowledge, because next time with a similar issue you'll need support again. But these things are basic Linux knowledge.
I did: chmod 0775 /var/www/vhosts/stefan-franz.de/nextcloud/config
and: chmod 0660 /var/www/vhosts/stefan-franz.de/nextcloud/config/config.php
So it doesn't work.
Maybe i should have changed the Nextcloud directory too
chmod 0775 /var/www/vhosts/stefan-franz.de/nextcloud

And yes, i learn the Linux basics step by step. Thank you for your support.
 
The difference between
drw-r--r-- 2 stefan-franz psacln 4096 Mär 29 08:05 ./
and
drwxr-xr-x 2 stefan-franz psacln 4096 Mär 29 08:05 ./
is that you applied the command to the directory, not the file. You can change the directory back to 0755 by running
# chmod 0755 <your directory>
Thanks for the information!
 
Back
Top