Programming

Linux, 그룹 권한이 있는데도 쓸 수없는 이유는 무엇입니까?

procodes 2020. 8. 18. 19:27
반응형

Linux, 그룹 권한이 있는데도 쓸 수없는 이유는 무엇입니까?


내가 속한 직원 그룹이 소유 한 디렉토리에 파일을 만들고 싶습니다. 왜 이렇게 할 수 없습니까?

bmccann@bmccann-htpc:~$ ls -l /usr/local/lib/R/
total 4
drwxrwsr-x 2 root staff 4096 2010-07-31 16:21 site-library
bmccann@bmccann-htpc:~$ id -nG bmccann
bmccann adm dialout cdrom plugdev staff lpadmin admin sambashare
bmccann@bmccann-htpc:~$ touch /usr/local/lib/R/site-library/tmp
touch: cannot touch `/usr/local/lib/R/site-library/tmp': Permission denied

그룹을 변경 한 후 로그 아웃했다가 다시 로그인 했습니까? 참조 :
터치 권한 실패와 관련된 수퍼 유저 답변


Linux 사용자가 자신이 속한 그룹의 파일을 편집 할 수없는 이유는 무엇입니까?

나는 Ubuntu 12.04를 사용하고 있으며 사용자가 그룹 액세스가 허용 된 파일에 쓸 수없는 동일한 문제가 발생했습니다. 예를 들면 :

whoami                                        //I am user el
  el                                            

touch /foobar/test_file                       //make a new file

sudo chown root:www-data /foobar/test_file    //User=root  group=www-data

sudo chmod 474 /foobar/test_file              //owner and others get only read, 
                                              //group gets rwx


sudo groupadd www-data                        //create group called www-data    

groups                                        //take a look at the groups and see
 www-data                                     //www-data exists.

groups el                                     //see that el is part of www-data
  el : www-data                               

지금 터미널을 다시 시작하여 사용자와 그룹이 적용되었는지 확인하십시오. el으로 로그인하십시오.

vi /foobar/test_file                          //try to edit the file.

경고를 생성합니다.

Warning: W10: Warning: Changing a readonly file"

뭐? 나는 모든 것을 옳게했다 왜 그것이 작동하지 않는가?

대답:

컴퓨터를 완전히 재부팅하십시오. 터미널을 중지하는 것만으로는 이러한 문제를 해결할 수 없습니다.

나는 apache2가 www-data 그룹을 사용한다고 생각하므로 작업은 어떻게 든 사용자와 그룹이 올바르게 적용되는 것을 방해했습니다. 로그 아웃 할뿐만 아니라 그룹을 사용하는 모든 서비스를 중지하고 다시 시작해야합니다. 재부팅해도 문제가 해결되지 않으면 더 큰 문제가있는 것입니다.


동일한 문제가 발생했습니다. 폴더에 ACL 규칙이 더 있는지 확인하십시오!

폴더를 나열 할 때 + (더하기 기호)가 보이면 특별한 액세스 규칙이 있음을 의미합니다. 예를 들면 :

[user_in_apache_group@web02 html]$ ls -l
total 16
drwxrwxr-x  16 apache apache 4096 Sep  4 13:46 ilias
drwxrwxr-x+ 15 apache apache 4096 Sep  4 13:46 ilias5

권한보기 :

[user_in_apache_group@web02 html] getfacl ilias5
# file: ilias5
# owner: apache
# group: apache
user::rwx
user:user_in_apache_group:r-x
group::rwx
mask::rwx
other::r-x

따라서 내 사용자 (user_in_apache_group)가 해당 폴더에 대한 쓰기 권한이 없음을 의미합니다.

해결책은 @techtonik이 말한 것입니다. 사용자에게 쓰기 권한을 추가하십시오.

[user_in_apache_group@web02 html]$ sudo setfacl -m u:user_in_apache_group:rwx ./ilias5

권한을 다시 확인하십시오.

[user_in_apache_group@web02 html] getfacl ilias5
...
user:user_in_apache_group:rwx
...

도움이되기를 바랍니다. ;)


Linux ACL (액세스 제어 목록) 사용-더 세분화 된 권한 시스템 버전입니다.

setfacl -R -m 'group:staff:rwx' -m 'd:group:staff:rwx' /usr/local/lib/R/

This sets both active rights for directory and default rights for anything created within.

This fails to work without relogin if you've just added yourself to the staff group, but you may set the permission only for yourself for the current session.


I had an issue when a user could not access the /foo/bar/baz directory even when he had permissions because he did not have an access to the bar directory.


Check if your parent directory have permission before you add content to that file

sudo chmod -R 777 /yourDir/file.log

참고URL : https://stackoverflow.com/questions/5054888/linux-why-cant-i-write-even-though-i-have-group-permissions

반응형