Score:0

Aliasing a user (id) in CentOS7/8

ru flag

I am in the process of replacing some apache instances with nginx (for performance, mostly). For some time I will need to switch from one to the other. The packagers, in their infinite wisdom, decided to use diiferent user/group IDs for the two servers (nginx/nginx and apache/apache: probably using the same for both - httpd/httpd, say - would have been too mundane).

That's a royal PITA (because all permissions are tuned to apache and I don't want to CHOWN back and forth as I switch between servers). So I want to alias user/group nginx to apache by giving them the same IDs. I've done it in the past, so I know that

  • it's possible and
  • to some extent it works

But it was years ago and I do not know if intervening OS changes may bite my ass sometime in the future (the idea is that at some point I will toss apache completely, user, group and all but permissions and stuff will still apply to user/group nginx).

So the question is, is this still doable and are there pitfalls I do not know of?

TIA.

Michael Hampton avatar
cz flag
Something is wrong here. Why are _any_ of your web documents owned by the apache user?
Alien Life Form avatar
ru flag
@MichaelHampton Because php applications need to write to select parts of the filesystem (e.g. wp-contents/uploads for wordpress) and that happens with whatever user the webserver (or, the fastcgi subsystem, php-fpm) runs under. That's pretty standard, if unsavory.
Michael Hampton avatar
cz flag
OK, it is normal for web uploads to be owned by PHP. In the nginx php-fpm setup they'll be owned by the php user. You may as well chown them. It's just a one-time thing. I personally use ACLs to manage permissions for web files, so I'll have to see if I can dig up what I've previously written about that.
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.