CLI in apps: files and directory created got root ownership
-
In apps (at least WP-D) when you create a directory or file in the app-Terminal it gets 'root' as owner. Is this intended?
I noticed that after restart of the app it has www-data. -
The terminal for most apps (if not all) default to login as "root" so this is by design. Restarting fixes the perms cause the startup script switches them to whatever the app needs (in wordpress's case it's www-data" if you wanna make it like that from the get go:
Use either:
chown www-data:www-data <whatever dir>Or:
su - www-datathen mkdir where ever you need it:mkdir <whatever dir> -
The apps itself run with minimal permissions but the Web Terminal gives you "root" access (this is a limited root and not server root) so that you can creates files as any user since some apps use multiple users. It's also required in situations where you restore/import the app and those files have different permissions than the one app uses.
But tl;dr this is intended. Use su like @murgero said or you can use gosu <username> <cmd> as well
-
J joseph marked this topic as a question on
-
J joseph has marked this topic as solved on
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login