1 |
On 2022.03.09 13:28, Dr Rainer Woitok wrote: |
2 |
> Greetings, |
3 |
> |
4 |
> until recently my system behaves sort of strangely: |
5 |
> |
6 |
> $ touch /tmp/file |
7 |
> $ ls -l /tmp/file |
8 |
> -rw------- 1 rainer rainer 0 2022-03-09 19:06 /tmp/file |
9 |
> $ echo x | sudo tee /tmp/file |
10 |
> Password: |
11 |
> tee: /tmp/file: Permission denied |
12 |
> x |
13 |
> $ chmod a+w /tmp/file |
14 |
> $ ls -l /tmp/file |
15 |
> -rw--w--w- 1 rainer rainer 0 2022-03-09 19:06 /tmp/file |
16 |
> $ echo x | sudo tee /tmp/file |
17 |
> tee: /tmp/file: Permission denied |
18 |
> x |
19 |
> $ |
20 |
> |
21 |
> Since when can't root write to files it doesn't own? And not even, |
22 |
> if |
23 |
> the file has write permission for everybody? |
24 |
> |
25 |
> This worked as long as I can think of. My last routine upgrade |
26 |
> install- |
27 |
> ed new kernel package "sys-kernel/gentoo-sources-5.15.26", so I |
28 |
> built |
29 |
> the new kernel and booted from it. May this be the reason? |
30 |
> |
31 |
> When I'll have time to reboot, I'll test the above commands on my |
32 |
> old |
33 |
> kernel, 5.15.19. But perhaps there's another reason? |
34 |
> |
35 |
> Slightly puzzled |
36 |
> Rainer |
37 |
Just a gues, but try something like 'sudo -c "echo x | tee /tmp/file"' |
38 |
or just su first and then do the echo and tee. I think perhaps the |
39 |
permission error is not for root writing to /tmp/file but for the echo |
40 |
x trying to write to a tee owned by root. |