lxc list run via sudo creates root-owned files in the user's home directory

Bug #1844663 reported by Rod Smith
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxd (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

LXD description:
1. Fresh 18.04 server
2. Run "sudo lxc list"
3. Note new root owned ~/.config directory.

This does not occur on Eoan including with snap version of 3.0.4.

Previous description:
On a fresh Ubuntu 18.04 server installation, running sosreport creates root-owned files in ~/.config. Specifically, I'm using the following command:

sudo sosreport --batch --tmp-dir /tmp/

Prior to running this command, ~/.config did not exist. After running the command, ~/.config exists and is owned by root, with a lxd subdirectory:

$ sudo ls -lR .config
.config:
total 4
drwxr-x--- 2 root root 4096 Sep 19 12:16 lxc

.config/lxc:
total 8
-rw-r--r-- 1 root root 188 Sep 19 12:16 config.yml
-rw------- 1 root root 5 Sep 19 12:16 cookies

This root ownership of ~/.config and ~/.config/lxd causes problems for subsequent programs run without sudo.

$ apt-cache policy sosreport
sosreport:
  Installed: 3.6-1ubuntu0.18.04.3
  Candidate: 3.6-1ubuntu0.18.04.3
  Version table:
 *** 3.6-1ubuntu0.18.04.3 500
        500 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     3.5-1ubuntu3 500
        500 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 Packages

I've reported this bug upstream:

https://github.com/sosreport/sos/issues/1787

Revision history for this message
Bryan Quigley (bryanquigley) wrote :

Reassigning to LXD, as it's reproducible with a simple
sudo lxc list.

summary: - sosreport run via sudo creates root-owned files in the user's home
+ lxc list run via sudo creates root-owned files in the user's home
directory
description: updated
affects: sosreport (Ubuntu) → lxd (Ubuntu)
Revision history for this message
Dan Streetman (ddstreet) wrote :

This is likely due to bug 1556302, which is fixed starting in Eoan but will not be changed in Disco or earlier.

On Ubuntu releases pre-Eoan, sudo should be invoked with -H or -i (the -i param does more than -H, but both will change $HOME to the target user's home dir).

Revision history for this message
Stéphane Graber (stgraber) wrote :

Marking as invalid for LXD. This is a question of how you're using or configuring sudo.

Changed in lxd (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.