I have some strange behavior I don't understand. I'm just trying to list some files in a directory:
sudo find /home/vsts/work/_temp/tmp.Q8K2bSeNVV/root/home/root produces:
/home/vsts/work/_temp/tmp.Q8K2bSeNVV/root/home/root/ /home/vsts/work/_temp/tmp.Q8K2bSeNVV/root/home/root/.gnupg /home/vsts/work/_temp/tmp.Q8K2bSeNVV/root/home/root/.gnupg/trustdb.gpg /home/vsts/work/_temp/tmp.Q8K2bSeNVV/root/home/root/.gnupg/private-keys-v1.d /home/vsts/work/_temp/tmp.Q8K2bSeNVV/root/home/root/.gnupg/S.gpg-agent /home/vsts/work/_temp/tmp.Q8K2bSeNVV/root/home/root/.gnupg/S.gpg-agent.extra /home/vsts/work/_temp/tmp.Q8K2bSeNVV/root/home/root/.gnupg/pubring.kbx~ /home/vsts/work/_temp/tmp.Q8K2bSeNVV/root/home/root/.gnupg/S.gpg-agent.browser /home/vsts/work/_temp/tmp.Q8K2bSeNVV/root/home/root/.gnupg/pubring.kbx /home/vsts/work/_temp/tmp.Q8K2bSeNVV/root/home/root/.gnupg/S.gpg-agent.ssh So I know the .gnupg directory exists, and has files in it.
sudo ls -la /home/vsts/work/_temp/tmp.Q8K2bSeNVV/root/home/root produces:
total 12 drwx------ 3 root root 4096 Sep 21 14:54 . drwxr-xr-x 3 root root 4096 Aug 24 18:30 .. drwxr-xr-x 3 root root 4096 Sep 21 14:54 .gnupg So the directory itself has rwx permissions.
But the command sudo ls -la /home/vsts/work/_temp/tmp.Q8K2bSeNVV/root/home/root/.gnupg/* gives:
ls: cannot access '/home/vsts/work/_temp/tmp.Q8K2bSeNVV/root/home/root/.gnupg/*': No such file or directory I've checked the path over and over and can't see anything wrong. I have rwx permissions and root level access. What else could stop me from listing this directory?
My ultimate goal is to do a chmod 600 /home/vsts/work/_temp/tmp.Q8K2bSeNVV/root/home/root/.gnupg/*, which also fails. But for now I'd settle for ls.
Edit: It just hit me. Does this have to do with the file globbing. Does the * expand before sudo, and therefor without root access?
find, why not go all the way withsudo find /home/…/.gnupg -type f -exec chmod 600 {} \;