Skip to content

Instantly share code, notes, and snippets.

@fenar
Created August 22, 2024 20:40
Show Gist options
  • Select an option

  • Save fenar/341a32efadebdfce55a3e30fe9503fa5 to your computer and use it in GitHub Desktop.

Select an option

Save fenar/341a32efadebdfce55a3e30fe9503fa5 to your computer and use it in GitHub Desktop.
pod-perm-debugging
fenar@macpro71 projects % oc get pods
NAME READY STATUS RESTARTS AGE
tme-aix-wb01-0 2/2 Running 0 6h54m
fenar@macpro71 projects % oc exec tme-aix-wb01-0 -- ls -l /var/log
Defaulted container "tme-aix-wb01" out of: tme-aix-wb01, oauth-proxy
total 612
-rw-rw----. 1 root utmp 0 Jun 28 14:09 btmp
-rw-r--r--. 1 root root 147607 Jun 28 14:49 dnf.librepo.log
-rw-r--r--. 1 root root 399490 Jun 28 14:49 dnf.log
-rw-r--r--. 1 root root 69372 Jun 28 14:49 dnf.rpm.log
-rw-r--r--. 1 root root 2880 Jun 28 14:49 hawkey.log
drwx------. 2 root root 10 Apr 28 2023 httpd
-rw-rw-r--. 1 root utmp 0 Jun 28 14:09 lastlog
drwx------. 2 root root 6 Jun 28 14:09 private
lrwxrwxrwx. 1 root root 39 Jun 28 14:09 README -> ../../usr/share/doc/systemd/README.logs
drwxr-xr-x. 1 root root 30 Jan 18 2024 rhsm
-rw-------. 1 root root 0 Jun 28 14:09 tallylog
-rw-rw-r--. 1 root utmp 0 Jun 28 14:09 wtmp
fenar@macpro71 projects % oc exec tme-aix-wb01-0 -- id
Defaulted container "tme-aix-wb01" out of: tme-aix-wb01, oauth-proxy
uid=1001(default) gid=0(root) groups=0(root)
fenar@macpro71 projects % oc exec tme-aix-wb01-0 -- cat /var/log/tallylog
Defaulted container "tme-aix-wb01" out of: tme-aix-wb01, oauth-proxy
cat: /var/log/tallylog: Permission denied
command terminated with exit code 1
# Above Permission Denied is being caused by the fact that tallylog owned by root (0) and default userid for exec/bash is 1001.
# Way to overcome this problem is to make sure your log being owned by 1001 user and/or it has r permission for others.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment