I am currently preparing for LPIC Level 1 exam and I have been practicing management of user accounts on CentOS 7 system installed on VirtualBox.
Firstly, as root, I created a user 'foo' with group 'bar' and practiced changing file permissions. Then I created a new group 'somegroup' and added user 'foo' to it. Then I removed user 'foo' from group 'bar'. (Kindly note that I used 'groupmems' command for this.)
Then I logged into foo's account and used 'touch' command for creating a file in foo's ~/Documents directory and then checked its file permissions with 'ls -l' command. I was expecting that the new file would show file ownership as belonging to 'foo somegroup' but strangely I found that the group ownership was still with group 'bar'.
Clearly I'm missing some basic knowledge here. Please help me in understanding this. (I'm sorry if I've been a bit too verbose.)
groupmems
command. What does it do? What is the output ofgetent passwd foo
? What aboutls -ld ~foo/Documents
?