New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to use sudo inside a container #3218

Closed
dann1 opened this Issue Apr 24, 2017 · 5 comments

Comments

2 participants
@dann1

dann1 commented Apr 24, 2017

lxc info

  • Distribution: Ubuntu
  • Distribution version: 16.04
  • The output of "lxc info" or if that fails:
    config:
    core.https_address: 0.0.0.0:8443
    core.trust_password: true
    apiextensions:
  • id_map
    apistatus: stable
    apiversion: "1.0"
    auth: trusted
    public: false
    environment:
    addresses:
    • 10.8.9.130:8443
      architectures:
    • x86_64
    • i686
      driver: lxc
      driverversion: 2.0.3
      kernel: Linux
      kernelarchitecture: x86_64
      kernelversion: 4.4.0-31-generic
      server: lxd
      serverpid: 9342
      serverversion: 2.0.9
      storage: dir
      storageversion: ""

Issue description

I get a message sudo: no tty present and no askpass program specified when executing a command with sudo inside a container. In the online demo this works OK.

Steps to reproduce

lxc exec container bash
su - ubuntu
sudo apt update
sudo: no tty present and no askpass program specified
@dann1

This comment has been minimized.

Show comment
Hide comment
@dann1

dann1 Apr 24, 2017

Also I added a new user (team) and when trying swapping users with su I get another message

root@lxdone:~# su - ubuntu
ubuntu@lxdone:~$ su - team
su: must be run from a terminal

Note that neither su nor sudo fail when using them as root

dann1 commented Apr 24, 2017

Also I added a new user (team) and when trying swapping users with su I get another message

root@lxdone:~# su - ubuntu
ubuntu@lxdone:~$ su - team
su: must be run from a terminal

Note that neither su nor sudo fail when using them as root

@brauner

This comment has been minimized.

Show comment
Hide comment
@brauner

brauner Apr 24, 2017

Member

Yeah, this is a classical problem that LXD itself can not really do something about. In short, sudo and su should be fixed to handle pty devices from different namespaces. Without going into detail and repeating it all: it's basically another variant of #936 and #1724 .

Member

brauner commented Apr 24, 2017

Yeah, this is a classical problem that LXD itself can not really do something about. In short, sudo and su should be fixed to handle pty devices from different namespaces. Without going into detail and repeating it all: it's basically another variant of #936 and #1724 .

@brauner brauner closed this Apr 24, 2017

@dann1

This comment has been minimized.

Show comment
Hide comment
@dann1

dann1 Apr 26, 2017

Ok thanks, I thought I had done something wrong generating the image

dann1 commented Apr 26, 2017

Ok thanks, I thought I had done something wrong generating the image

@dann1

This comment has been minimized.

Show comment
Hide comment
@dann1

dann1 Jul 17, 2017

Hello again, if you enter sudo with argument -S, say, sudo -S apt update it gets the job done

dann1 commented Jul 17, 2017

Hello again, if you enter sudo with argument -S, say, sudo -S apt update it gets the job done

@dann1

This comment has been minimized.

Show comment
Hide comment
@dann1

dann1 Jul 17, 2017

Also this works for su

dann1 commented Jul 17, 2017

Also this works for su

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment