문제 설명
이미 같은 이름의 그룹에 있는데 사용자를 전환하는 이유는 무엇입니까? (Why to switch user when I am already in the group with the same name?)
우분투 리눅스 서버에서: /home/abc/data/에 액세스할 때 권한 오류가 발생했습니다. abc 그룹에 추가해야 한다고 들었습니다. 그들은 나를 추가했습니다. 해당 디렉토리로 cd할 때 여전히 동일한 권한 오류가 발생합니다. 그런 다음 해당 디렉토리에 액세스하려면 abc 사용자로 전환하려면 sudo su ‑ abc
를 수행해야 한다고 말했습니다. 이미 abc 그룹에 있는데 왜 abc로 su를 해야 합니까? abc는 그룹이 아니라 사용자인가요? 혼란스럽습니다.
참조 솔루션
방법 1:
abc
might be a user, or a group, or both ‑‑ which depends on how your system is set up, but generally on Ubuntu, every user has a corresponding group with the same name. So it is probably both a user and a group.
Accessing the directory in question might be a question of either user or group permissions. Try doing ls ‑ld /home/abc
, which will show you the permissions on that directory. It will give you an output something like
drwxr‑xr‑x 248 abc abc 16384 Feb 24 09:17 /home/abc
The letters at the beginning are the permissions. In this case the first rwx
are the 'user' permissions (meaning the user abc
has read, write, and execute permission here) while the second r‑x
are the 'group' permissions, (meaning group abc
has read and execute permissions, but not write permissions).
If the group permissions are adequate for what you want to do, you need only be in group abc
. If on the other hand, you need something only allowed by the user permissions, you need to be user abc
. The latter is generally considered bad form and a mis‑configuration.
To see what groups you are a member of, use the groups
command.
(by topcan5、Chris Dodd)