C
C
chelkaz2017-02-26 07:03:48
linux
chelkaz, 2017-02-26 07:03:48

Can one user edit files for another?

I have a user without the ability to login via ssh:
www:x:1001:1001::/home/www:/sbin/nologin
Apache and Nginx run under him
And a folder with sites was created for him. /data/wwwroot/ {everything here is under user and group www : www}
But I don't need a root user to edit sites and I created a new one: wwwdev and gave it the group www

#groups wwwdev
wwwdev : wwwdev www

But if I connect via sftp as user wwwdev and try to edit files in /data/wwwroot/
then Permission denied
----------------
Files in /data/wwwroot/:
drwxr-xr-x  5 www www   4096 фев  4 05:49 database
-rw-r--r--  1 www www    550 фев 26 08:35 .env
-rw-r--r--  1 www www    499 фев  4 05:49 .env.example
-rw-r--r--  1 www www     61 фев  4 05:49 .gitattributes

Why can't I edit files with the wwwdev user If from has the www group What am I doing wrong? How can I change files without changing the owner and group of the files?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
planc, 2017-02-26
@planc

Why can't I edit files with the wwwdev user

because the www group has read-only permissions
-rw-r--r--
user - group - everyone else,
or give write permissions to the www group
chmod g+w file_name
flag -R if you need to change permissions recursively in the
chmod folder - R g + w *
there is also such a feature as acl:
this is the ability to put different rights on one file, for different users
https://serversforhackers.com/video/linux-acls
https://wiki.archlinux.org/index. php/Access_Control...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question