Skip to main content
edited title
Link
jksoegaard
  • 79.6k
  • 4
  • 133
  • 204

How would I trace the uid/gid that a process runs as? Why does chunkwm fail with "Permission denied" error for .chunkwmrc

added 28 characters in body
Source Link
nohillside
  • 104.5k
  • 42
  • 222
  • 275

ashleyharvey@Themis:~$ ls -al /usr/local/opt/chunkwm/bin/chunkwm
-r-xr-xr-x 1 ashleyharvey admin 207K Mar 7 21:55 /usr/local/opt/chunkwm/bin/chunkwm

ashleyharvey@Themis:~$ ps aux | grep chunkwm
ashleyharvey 15153 0.0 0.1 4375940 20508 ?? S 11:23pm 0:01.33 /usr/local/opt/chunkwm/bin/chunkwm

ashleyharvey@Themis:~$ type /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm is /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm

ashleyharvey@Themis:~$ file /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm: Mach-O 64-bit executable x86_64

ashleyharvey@Themis:~$ ls -al /usr/local/opt/chunkwm/bin/chunkwm` 
-r-xr-xr-x 1 ashleyharvey admin 207K Mar  7 21:55 /usr/local/opt/chunkwm/bin/chunkwm

ashleyharvey@Themis:~$ ps aux | grep chunkwm` 
ashleyharvey     15153   0.0  0.1  4375940  20508   ??  S    11:23pm   0:01.33 /usr/local/opt/chunkwm/bin/chunkwm

ashleyharvey@Themis:~$ type /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm
/usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm is /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm
  
ashleyharvey@Themis:~$ file /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm
/usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm: Mach-O 64-bit executable x86_64

ashleyharvey@Themis:~$ ls -al /usr/local/opt/chunkwm/bin/chunkwm
-r-xr-xr-x 1 ashleyharvey admin 207K Mar 7 21:55 /usr/local/opt/chunkwm/bin/chunkwm

ashleyharvey@Themis:~$ ps aux | grep chunkwm
ashleyharvey 15153 0.0 0.1 4375940 20508 ?? S 11:23pm 0:01.33 /usr/local/opt/chunkwm/bin/chunkwm

ashleyharvey@Themis:~$ type /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm is /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm

ashleyharvey@Themis:~$ file /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm: Mach-O 64-bit executable x86_64

ashleyharvey@Themis:~$ ls -al /usr/local/opt/chunkwm/bin/chunkwm` 
-r-xr-xr-x 1 ashleyharvey admin 207K Mar  7 21:55 /usr/local/opt/chunkwm/bin/chunkwm

ashleyharvey@Themis:~$ ps aux | grep chunkwm` 
ashleyharvey     15153   0.0  0.1  4375940  20508   ??  S    11:23pm   0:01.33 /usr/local/opt/chunkwm/bin/chunkwm

ashleyharvey@Themis:~$ type /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm
/usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm is /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm
  
ashleyharvey@Themis:~$ file /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm
/usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm: Mach-O 64-bit executable x86_64
EDIT2: move comments up into the question itself and delete the comments.
Source Link
Harv
  • 5.8k
  • 19
  • 43
ashleyharvey@Themis:~$ ls -al .chunkwmrc
-rw------- 2 ashleyharvey staff 4.7K Apr  4 22:24 .chunkwmrc
ashleyharvey@Themis:~$ chunkwm
/bin/bash: /Users/ashleyharvey/.chunkwmrc: Permission denied

So, chunkwm is running obviously under a different uid than my own. One way to fix this would be to give a wider set of permissions: I could chmod 640 or chmod 644 the file; however my question is how to figure out which uid/gid a process runs as in order to fix that while maintaining as tight a security boundary as possible.

I did find an answer on the unix stackexchange site that had to do with running stat on a process, so I tried something along the lines of $ (stat /proc/$$/), but apparently because of the difference in the macOS kernel, that won't work. I ended up in /dev, but only found fd's for the standard in/out and a bunch of special stuff, clearly that's not where process FDs go.

EDIT1EDIT2:

More chunkwmrelevant info on chunkwm:

ashleyharvey@Themis:~$ ls -al /usr/local/opt/chunkwm/bin/chunkwm
-r-xr-xr-x 1 ashleyharvey admin 207K Mar  7 21:55 /usr/local/opt/chunkwm/bin/chunkwm

ashleyharvey@Themis:~$ ls -al /usr/local/opt/chunkwm/bin/chunkwm
-r-xr-xr-x 1 ashleyharvey admin 207K Mar 7 21:55 /usr/local/opt/chunkwm/bin/chunkwm

ashleyharvey@Themis:~$ ps aux | grep chunkwm
ashleyharvey 15153 0.0 0.1 4375940 20508 ?? S 11:23pm 0:01.33 /usr/local/opt/chunkwm/bin/chunkwm

ashleyharvey@Themis:~$ type /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm is /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm

ashleyharvey@Themis:~$ file /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm: Mach-O 64-bit executable x86_64

ashleyharvey@Themis:~$ ls -al .chunkwmrc
-rw------- 2 ashleyharvey staff 4.7K Apr  4 22:24 .chunkwmrc
ashleyharvey@Themis:~$ chunkwm
/bin/bash: /Users/ashleyharvey/.chunkwmrc: Permission denied

So, chunkwm is running obviously under a different uid than my own. One way to fix this would be to give a wider set of permissions: I could chmod 640 or chmod 644 the file; however my question is how to figure out which uid/gid a process runs as in order to fix that while maintaining as tight a security boundary as possible.

I did find an answer on the unix stackexchange site that had to do with running stat on a process, so I tried something along the lines of $ (stat /proc/$$/), but apparently because of the difference in the macOS kernel, that won't work. I ended up in /dev, but only found fd's for the standard in/out and a bunch of special stuff, clearly that's not where process FDs go.

EDIT1:

More chunkwm info:

ashleyharvey@Themis:~$ ls -al /usr/local/opt/chunkwm/bin/chunkwm
-r-xr-xr-x 1 ashleyharvey admin 207K Mar  7 21:55 /usr/local/opt/chunkwm/bin/chunkwm
ashleyharvey@Themis:~$ ls -al .chunkwmrc
-rw------- 2 ashleyharvey staff 4.7K Apr  4 22:24 .chunkwmrc
ashleyharvey@Themis:~$ chunkwm
/bin/bash: /Users/ashleyharvey/.chunkwmrc: Permission denied

So, chunkwm is running obviously under a different uid than my own. One way to fix this would be to give a wider set of permissions: I could chmod 640 or chmod 644 the file; however my question is how to figure out which uid/gid a process runs as in order to fix that while maintaining as tight a security boundary as possible.

I did find an answer on the unix stackexchange site that had to do with running stat on a process, so I tried something along the lines of $ (stat /proc/$$/), but apparently because of the difference in the macOS kernel, that won't work. I ended up in /dev, but only found fd's for the standard in/out and a bunch of special stuff, clearly that's not where process FDs go.

EDIT2:

More relevant info on chunkwm:

ashleyharvey@Themis:~$ ls -al /usr/local/opt/chunkwm/bin/chunkwm
-r-xr-xr-x 1 ashleyharvey admin 207K Mar 7 21:55 /usr/local/opt/chunkwm/bin/chunkwm

ashleyharvey@Themis:~$ ps aux | grep chunkwm
ashleyharvey 15153 0.0 0.1 4375940 20508 ?? S 11:23pm 0:01.33 /usr/local/opt/chunkwm/bin/chunkwm

ashleyharvey@Themis:~$ type /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm is /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm

ashleyharvey@Themis:~$ file /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm /usr/local/Cellar/chunkwm/0.4.8/bin/chunkwm: Mach-O 64-bit executable x86_64

Add EDIT1.
Source Link
Harv
  • 5.8k
  • 19
  • 43
Loading
Source Link
Harv
  • 5.8k
  • 19
  • 43
Loading