
groupA의 구성원인 user1과 user2라는 두 명의 사용자가 있습니다. user2의 홈 디렉터리에는 폴더A라는 폴더가 있습니다. 그룹A의 모든 구성원에게 읽기-쓰기-실행 권한을 허용하려면 어떻게 해야 합니까?
폴더A에 읽기-쓰기-실행 권한이 필요한 파일과 추가 폴더가 많이 포함되어 있으면 어떻게 되나요?
그룹에 관한 정보는 웹 전반에 걸쳐 약간 '불확실'하므로 누군가가 다른 사람에게도 도움이 될 수 있는 명확한 답변을 게시하길 바라면서 여기에 질문을 올립니다.
감사해요!
답변1
폴더A먼저 다음의 일부가 되어야 합니다.그룹A- 폴더의 소유자 또는 루트가 이 작업을 수행할 수 있습니다.
chgrp groupA ./folderA
그 다음에그룹A폴더에 대한 rwx 권한이 필요합니다
chmod g+rwx ./folderA
필요한 경우 디렉터리로 재귀적으로 실행하는 옵션이 chgrp
및 명령 에 있습니다 .chmod
답변2
이 분야에 대한 나의 경험입니다. 우분투 18.04에서 테스트되었습니다.
시스템 폴더에 쓰기 허용
폴더 에 쓰기 권한을 부여하십시오 /etc/nginx/
.
# Check 'webmasters' group doen't exist
cat /etc/group | grep webmasters
# Create 'webmasters' group
sudo addgroup webmasters
# Add users to 'webmasters' group
sudo usermod -a -G webmasters username
sudo usermod -a -G webmasters vozman
sudo usermod -a -G webmasters romanroskach
# Group assignment changes won't take effect
# until the users log out and back in.
# Create directory
sudo mkdir /etc/nginx/
# Check directory permissions
ls -al /etc | grep nginx
drwxr-xr-x 2 root root 4096 Dec 5 18:30 nginx
# Change group owner of the directory
sudo chgrp -R webmasters /etc/nginx/
# Check that the group owner is changed
ls -al /etc | grep nginx
drwxr-xr-x 2 root webmasters 4096 Dec 5 18:30 nginx
# Give write permission to the group
sudo chmod -R g+w /etc/nginx/
# Check
ls -al /etc | grep nginx
drwxrwxr-x 2 root webmasters 4096 Dec 5 18:30 nginx
# Try to create file
sudo -u username touch /etc/nginx/test.txt # should work
sudo -u username touch /etc/test.txt # Permission denied
폴더 에 쓰기 권한을 부여하십시오 /etc/systemd/system/
.
# List ACLs
getfacl /etc/systemd/system
getfacl: Removing leading '/' from absolute path names
# file: etc/systemd/system
# owner: root
# group: root
user::rwx
group::r-x
other::r-x
# Add 'webmasters' group to an ACL
sudo setfacl -m g:webmasters:rwx /etc/systemd/system
# Check
getfacl /etc/systemd/system
getfacl: Removing leading '/' from absolute path names
# file: etc/systemd/system
# owner: root
# group: root
user::rwx
group::r-x
group:webmasters:rwx
mask::rwx
other::r-x
sudo -u username touch /etc/systemd/system/test.txt # should work
sudo -u username touch /etc/systemd/test.txt # Permission denied