WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: What should the ownership be of /var?  (Read 228 times)

Offline rhermsen

  • Wiki Author
  • Full Member
  • *****
  • Posts: 117
What should the ownership be of /var?
« on: February 14, 2025, 09:22:29 AM »
I see a difference between 'x86_64' and 'pCore64'.

On TCL-15 x86_64 I'm used to root:staff have:

Code: [Select]
$ ls -la /var
total 0
drwxrwxr-x    8 root     staff          180 Mar 15  2024 ./
drwxr-xr-x   17 root     root           400 Mar 15  2024 ../
drwxrwxr-x    3 root     staff           60 Feb 14 14:04 cache/
drwxrwxr-x    3 root     staff           60 Feb 14 14:03 lib/
drwxrwxr-x    2 root     staff           40 Mar 15  2024 lock/
drwxrwxr-x    2 root     staff          120 Feb 14 14:04 log/
drwxrwxr-x    2 root     staff          160 Feb 14 14:03 run/
drwxrwxr-x    4 root     staff           80 Mar 15  2024 spool/
lrwxrwxrwx    1 root     root             4 Mar 15  2024 tmp -> /tmp/

Code: [Select]
$ version
15.0
$ uname -a
Linux testapps 6.6.8-tinycore64 #666 SMP Sat Dec 23 16:41:21 UTC 2023 x86_64 GNU/Linux

But on pCore-15.0 I have root:root:

Code: [Select]
$ ls -la /var
total 0
drwxrwxr-x  9 root root 200 Jan  1  1970 ./
drwxrwxr-x 17 root root 360 Jan  1  1970 ../
drwxrwxr-x  3 root root  60 Jan  1  1970 cache/
drwxr-xr-x  3 root root  60 Jan  1  1970 db/
drwxrwxr-x  5 root root 100 Jan  1  1970 lib/
drwxrwxr-x  2 root root  40 Aug  3  2024 lock/
drwxrwxr-x  2 root root  80 Jan  1  1970 log/
drwxrwxr-x  4 root root 200 Jan  1  1970 run/
drwxrwxr-x  4 root root  80 Jan  1  1970 spool/
lrwxrwxrwx  1 root root   4 Jan  1  1970 tmp -> /tmp

Code: [Select]
$ version
15.0
$ uname -a
Linux box 6.6.47-piCore-v8 #21 SMP PREEMPT Sat Aug 31 15:08:05 EDT 2024 aarch64 GNU/Linux



Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1334
Re: What should the ownership be of /var?
« Reply #1 on: February 14, 2025, 06:08:30 PM »
I’ve never set it in the initrd.  What is trying to write there that is not a root process

Offline rhermsen

  • Wiki Author
  • Full Member
  • *****
  • Posts: 117
Re: What should the ownership be of /var?
« Reply #2 on: February 14, 2025, 07:21:47 PM »
Would think that processes which are not running with root privilege should be able to to write in /var/log.
But on the other hand, I think /var/run should only be writable by root:root to prevent non-root users to tinker with pid's.

Didn't find a clear answer via google...

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11912
Re: What should the ownership be of /var?
« Reply #3 on: February 14, 2025, 08:10:30 PM »
Hi rhermsen
... On TCL-15 x86_64 I'm used to root:staff have: ...
That's what my TC14 x86_64 looks like too.

My TC10 x86 looks like this:
Code: [Select]
tc@E310:~$ ls -la /var
total 0
drwxr-xr-x  8 root root  180 Oct 23  2019 ./
drwxr-xr-x 17 root root  380 Feb  3 22:49 ../
drwxrwxr-x  3 root staff  60 Jan 26 19:02 cache/
drwxr-xr-x  6 root root  120 Jan 26 19:02 lib/
drwxrwxr-x  2 root staff  60 Jan 26 19:02 lock/
drwxr-xr-x  3 root root  160 Feb 10 16:00 log/
drwxr-xr-x  3 root root  200 Feb  2 17:04 run/
drwxrwxr-x  4 root staff  80 Jun  9  2019 spool/
lrwxrwxrwx  1 root root    4 Jun  9  2019 tmp -> /tmp

... But on the other hand, I think /var/run should only be writable by root:root to prevent non-root users to tinker with pid's. ...
What if a non-root process wants to store its PID there?

Offline rhermsen

  • Wiki Author
  • Full Member
  • *****
  • Posts: 117
Re: What should the ownership be of /var?
« Reply #4 on: February 15, 2025, 03:26:50 PM »
Hi Rick,

What if a non-root process wants to store its PID there?

Don't know if it is recommended/required to have /var/pid owned by root:root. Hope someone can answer that...
See often that start-stop scripts (init.d) require to be started by root, and the process is started as non-root.