I'm using Ubuntu 16.04 and lxc 2.0.7-0ubuntu1~16.04.1, I got this error sudo: no tty present and no askpass program specified
in an unprivileged container( Ubuntu 16.04 amd64).
This is my /dev
ubuntu@unpc:~$ ls -al /dev/ total 4 drwxr-xr-x 6 root root 500 Feb 22 08:57 ./ drwxr-xr-x 21 root root 4096 Feb 22 04:15 ../ crw--w---- 1 root tty 136, 6 Feb 22 09:02 console lrwxrwxrwx 1 root root 11 Feb 22 08:57 core -> /proc/kcore lrwxrwxrwx 1 root root 13 Feb 22 08:57 fd -> /proc/self/fd/ crw-rw-rw- 1 nobody nogroup 1, 7 Feb 21 07:00 full drwxr-xr-x 2 root root 40 Feb 22 08:57 hugepages/ lrwxrwxrwx 1 root root 25 Feb 22 08:57 initctl -> /run/systemd/initctl/fifo| lrwxrwxrwx 1 root root 28 Feb 22 08:57 log -> /run/systemd/journal/dev-log= drwxrwxrwt 2 nobody nogroup 40 Feb 22 08:57 mqueue/ crw-rw-rw- 1 nobody nogroup 1, 3 Feb 21 07:00 null lrwxrwxrwx 1 root root 13 Feb 22 08:57 ptmx -> /dev/pts/ptmx drwxr-xr-x 2 root root 0 Feb 22 08:57 pts/ crw-rw-rw- 1 nobody nogroup 1, 8 Feb 21 07:00 random drwxrwxrwt 2 root root 40 Feb 22 08:57 shm/ lrwxrwxrwx 1 root root 15 Feb 22 08:57 stderr -> /proc/self/fd/2 lrwxrwxrwx 1 root root 15 Feb 22 08:57 stdin -> /proc/self/fd/0 lrwxrwxrwx 1 root root 15 Feb 22 08:57 stdout -> /proc/self/fd/1 crw-rw-rw- 1 nobody nogroup 5, 0 Feb 22 09:06 tty crw--w---- 1 root tty 136, 0 Feb 22 09:02 tty1 crw--w---- 1 root tty 136, 1 Feb 22 09:02 tty2 crw--w---- 1 root tty 136, 2 Feb 22 09:02 tty3 crw--w---- 1 root tty 136, 3 Feb 22 09:02 tty4 crw-rw-rw- 1 nobody nogroup 1, 9 Feb 21 07:00 urandom crw-rw-rw- 1 nobody nogroup 1, 5 Feb 21 07:00 zero
lxc exec
?lxc exec
and got this error, so I have to modifysudoers
, let the user usesudo
without password.