Score:-2

Change permissions/ownership of file/directory owned by 33:33 in Linux

gb flag

I have a directory where I used to make the backup of my owncloud files from Ubuntu. It's owned by user 33 and group 33, which in Ubuntu are the www-data (Apache) user and group. Now I have changed the server's OS to OpenSUSE and the user and group for Apache are wwrun and www respectively with id 459. I'm pretty sure (although I haven't tried, but that's kind of irrelevant to the question) that that will give me problems when I mount that volume and try to backup stuff in it (it's not writable by everybody).

So I tried to change the ownership and/or the permissions of that directory, but even sudo and sudo -u www-data are impotent in this.

There are some similar questions around (like this, 15 years old), but I couldn't find any with an answer: is it at all possible to change owner or permission in such a case? If yes, how?

Further information

I tried the commands sudo chown -R user:user path/to/dir, sudo -u wwwrun chown -R user:user path/to/dir (because I was doing it from OpenSUSE) and sudo -u www-data chown -R user:user path/to/dir (because I was doing it to Ubuntu)
and each time I got the error permission denied.

I should however also say that I in the meantime "solved" the problem by mounting the disk with my uid and gid and now I have full access to it.

It would still be nice to know why those commands didn't work, since, like I said, by searching I have seen that other people have this problem.

vidarlo avatar
ar flag
What commands did you try? What error messages did you get? What is not working?
Score:0
in flag

You can w/o any problem to change the owner with command:

cd /var/www # or wherever they are web files
chown -R wwrun:www *

This will change the files and directories owner to wwrun and group to www

From comment: you can use option --from:

chown -R wwrun:www --from=33:33 *
Ginnungagap avatar
gu flag
It might be worth noting the `--from=33:33` option which is particularly useful in this case since it would allow to remap the old uid/God to the new ones without affecting other backups (if there are any).
Romeo Ninov avatar
in flag
@Ginnungagap, probably. To be honest I didn't know this option :)
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.