[Bug 2131153] Re: wrong /dev/pts owner for login shell (and $HOME)

Simon Johnsson 2131153 at bugs.launchpad.net
Thu Nov 13 08:38:10 UTC 2025


Hi Jonas! Thank you for the bug report. Using a fresh questing container
I get the following results when running the provided commands:

```
❯ lxc exec canonical -- sudo-rs -i -u ubuntu
ubuntu at canonical:~$ ls
ubuntu at canonical:~$ pwd
/home/ubuntu
ubuntu at canonical:~$ echo $HOME
/home/ubuntu

ubuntu at canonical:~$ tty
/dev/pts/2
ubuntu at canonical:~$ ls -l /dev/pts/2
crw--w---- 1 root tty 136, 2 Nov 13 08:22 /dev/pts/2
```

1) It seems that I cannot reproduce the incorrect $HOME variable on my
system. Could you verify with an unmodified container?

2) I can reproduce the pty owning issue. I will forward this to
upstream, thanks!


** Changed in: rust-sudo-rs (Ubuntu)
       Status: New => Triaged

** Changed in: rust-sudo-rs (Ubuntu)
     Assignee: (unassigned) => Simon Johnsson (bamf0)

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to rust-sudo-rs in Ubuntu.
https://bugs.launchpad.net/bugs/2131153

Title:
  wrong /dev/pts owner for login shell (and $HOME)

Status in rust-sudo-rs package in Ubuntu:
  Triaged

Bug description:
  sudo-rs doesn't set a login shells /dev/pts owner correctly and
  doesn't set its $HOME, while sudo.ws does.

  sudo.ws:

  jj at host % lxc exec canonical -- sudo.ws -i -u ubuntu
  ubuntu at canonical ~ % pwd
  /home/ubuntu
  ubuntu at canonical ~ % echo $HOME
  /home/ubuntu
  ubuntu at canonical ~ % tty
  /dev/pts/4
  ubuntu at canonical ~ % ls -la /dev/pts/4
  crw--w---- 1 ubuntu tty  136, 4 Nov 12 15:37 4

  sudo-rs:

  jj at host % lxc exec canonical -- sudo-rs -i -u ubuntu
  canonical% pwd
  /home/ubuntu
  canonical% echo $HOME
  /root
  canonical% tty
  /dev/pts/4
  ubuntu at canonical ~ % ls -l /dev/pts/4
  crw--w---- 1 root tty  136, 4 Nov 12 15:28 4

  two bugs in sudo-rs:
  - pty owner is wrong (should be the login user, not root)
  - HOME is not set (it is in env_keep) (and it works with: lxc exec canonical -- sudo-rs HOME=/home/ubuntu -i -u ubuntu)

  correct pty owning is important, otherwise e.g. gpg-agent can't show
  pinentry on the terminal where gpg was invoked on!

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/rust-sudo-rs/+bug/2131153/+subscriptions




More information about the foundations-bugs mailing list