Suppose the following three people operate the web server.
I don't want to depend on the user for permission of the application directory.
In this case, would it be a problem for everyone to log in with their own account and then work as root?
Or would it be better to create a working user instead of root and switch to su
after logging in?
You may know depending on the situation, but please let me know what I should be careful about.
php linux centos apache nginx
1) Create an administrator user group, and make the directory permissions to the user group.
2) Users (suzuki, tanaka, yamada) who are administrators are added to the user group of administrators, so that three people can log in as respective users to perform administrator work.
I think it's appropriate that
In this way, directory permissions are independent of specific users, and even if the users you manage change, you can change the membership of the user group.
It's convenient to do anything with su or root, but you should ensure that you have sufficient privileges because you can accidentally erase files on your system.
The principle is
Yes, you should not log in as root or as root in su.
How to create a collaborative environment is roughly as follows
If existing groups like www or apache are sufficient for you, you don't need them.
Enumerate user names separated by commas at the end of the group entry in /etc/group
www:*:80:suzuki,tanaka
chown:www/var/www/html
chmodg+s/var/www/html
This causes the group to become www
and further setgid to the directory if you create the file below /var/www/html.If you have an existing file, change it accordingly.
In .bashrc, etc.,
umask002
Let's say
If only setgid of 2, the group will be replaced, but the permission is only r, so it doesn't make much sense.By setting the umask above, the group will have a w, so you can edit it.
%toucha
% umask002
% touch b
% ll
total1
-rw -r --r -- 1 foo ww 0 January 28 21:40 a
-rw-rw-r -- 1 foo ww 0 January 28 21:40 b
Now,
You can say that
Alternatively, you can use a version control tool to manage your files, such as /var/www/html, to write only to write files that the deployment tool has retrieved from the version control tool.
© 2024 OneMinuteCode. All rights reserved.