Score:0

Ownership Issue with wordpress group and user Server and SFTP

tz flag

First off, thanks to all of you being so supportive in this Forum. I came here to resolve many problems already posted by the community. Today I am reaching out to you because I am noticing an odd behavior and unfortunatley, the solutions I found here are not working for me.

I am not sure what Linux version I have so I will post the Serverdetails here:

Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye
Static hostname: mx.###.###
Icon name: ###
Chassis: vm
Machine ID: ###
Boot ID: ###
Virtualization: kvm
Operating System: Debian GNU/Linux 11 (bullseye)
Kernel: Linux 5.10.0-22-amd64
Architecture: x86-64

I have a chown and writing issue with WordPress and STFP; conflicting ownership issues.

Every time I change the owner (chown -R mark:www-owner directory/) to write files via SFTP, WordPress looses the writing permissions. It then asks me to enter the FTP credentials every time I want to install something or update the WP instance.

I have a Sudo User, let's call him Mark. Mark is as well a Sudo user and a normal user, that I can change to sudo with the sudo -i command.

In my file system, the default ownership for all files and folders is set to www-owner:www-owner. I just set up the SFTP, so I could also easily upload some files to my server without the need to start the console and drop them on the server first. For that I had to change the writing permissions for the user Mark, so I could upload files to the SFTP. But then WP lost all the writing permissions

This is the setup I tried:

  1. Default ownership: www-owner:www-owner (WordPress operates just fine with this) -> Problem here: I don't have writing permissions via SFTP with the user Mark.
  2. I changed the ownership for folders and subfolders (chown -R) to mark:www-owner. -> Now I have writing permissions via SFTP with the user Mark, but WordPress cannot write anymore in the specified folder and the issues start piling up.
  3. I added to both users www-owner and Mark to a Group called "wp-admin" and changed the ownership of the folders to mark:wp-admin. I have the same issue as in 2.

Conclusion:

  1. If www-owner is both the owner and the group, WP works fine. But I have no permissions to upload or change files via SFTP with the user Mark.

  2. If I change the ownership to mark:www-owner. WP cannot write files anymore.

I also tried adding both users to a new group called wp-admin and changed the ownership to mark:wp-admin. Same issue here, WP cannot write files.

I want to achieve, that both users can write in the directory as of wp-admin:wp-admin. But as I only have a group called wp-admin, I get the error that wp-admin user does not exist. So, I seem to be unable to add a group of as owners.

I am at the end of my vocabulary and I would appreciate your help. Thanks in advance.

David avatar
cn flag
There is no such version of Ubuntu as 20.14. Please correct the question.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.