Note: Username modified for public post.
I have a linux server on which I have root privileges. There is a user account "privuser" which can only be SSHed into using SSH keys. But, due to some user changes, privuser cant read his own directory anymore. Neither can I in-spite of being root!
[root@server ~]# id privuser uid=29772(privuser) gid=509(abc) groups=509(abc),1519(ghi) [root@server ~]# groups privuser privuser : abc ghi [root@server ~]# su - privuser su: warning: cannot change directory to /usr/home/xyz/abc/privuser: Permission denied Your password expires on never -bash: cd: /usr/home/xyz/abc/privuser: Permission denied cannot cd to home directory /usr/home/xyz/abc/privuser -bash: /usr/home/xyz/abc/privuser/.bash_profile: Permission denied -bash-4.1$ exit logout -bash: /usr/home/xyz/abc/privuser/.bash_logout: Permission denied
I cant see those files even as Root.
[root@server ~]# ls -alh /usr/home/xyz/abc/privuser/ ls: cannot access /usr/home/xyz/abc/privuser/: Permission denied
However, /usr/home/xyz/abc/privuser is an NFS mount, so I can check from directly on the NFS server that, the directory and files are indeed owned by that UID.
How do I find out what is going on here?
EDIT: (Adding ls output)
testuser is another user in the server belonging to the same group - abc as the trouble making user(privuser), and here is what I can ls from testuser.
[testuser@server ~]$ ls -alh /usr/home/xyz/abc/ total 196K drwxr-s--- 37 root xyz 4.0K Nov 2 15:47 . drwxr-xr-x 9 root root 4.0K Feb 1 2016 .. drwx------ 5 testuser abc 4.0K Nov 29 14:12 testuser drwxr-xr-x 13 privuser abc 16K Jan 4 21:05 privuser .....
testuser, belonging to the same group abc can see the files of privuser.
testuser@server ~]$ ls -alh /usr/home/xyz/abc/privuser total 124K drwxr-xr-x 13 privuser abc 16K Jan 4 21:05 . drwxr-s--- 37 root **xyz** 4.0K Nov 2 15:47 .. <========== !! drwxr-xr-x 2 privuser abc 4.0K Jan 4 12:38 arkiv20180104 -rw------- 1 privuser abc 15K Jan 4 21:05 .bash_history -rw-r--r-- 1 privuser abc 99 Jan 4 12:31 .bashrc drwxr-xr-x 3 privuser abc 4.0K Jan 4 12:42 .conda drwx------ 2 privuser abc 4.0K Jan 23 2017 .ssh ....
Solution: privuser did not belong to the group xyz in spite of its home directory being located in a directory owned by xyz. I added privuser to the xyz group and the permissions problem went away.