canonical / lxd

Powerful system container and virtual machine manager
https://canonical.com/lxd
GNU Affero General Public License v3.0
4.38k stars 931 forks source link

Multiple pushes to the same file fail #10122

Closed monstermunchkin closed 2 years ago

monstermunchkin commented 2 years ago

Required information

Issue description

Pushing a file to an instance works fine the first time. Any subsequent push to the same file, fails with

Error: sftp: "open /tmp/testfile2: permission denied" (SSH_FX_FAILURE)

Steps to reproduce

  1. uuidgen | lxc file push - c1/tmp/testfile
  2. uuidgen | lxc file push - c1/tmp/testfile
  3. Error: sftp: "open /tmp/testfile: permission denied" (SSH_FX_FAILURE)
stgraber commented 2 years ago

Interesting, the issue seems limited to /tmp somehow :)

stgraber commented 2 years ago

Ah, it's an issue with kernel security and the sticky bit I believe.

stgraber commented 2 years ago

So I'm not sure that this should be treated as a bug given that:

root@speedtest:~# echo blah > /tmp/a
bash: /tmp/a: Permission denied
stgraber commented 2 years ago

Closing as it's expected behavior for writes from the root user against a file owned by non-root on a sticky-bit folder like /tmp (1777 permissions).