/dev/pts being created with mode=600 by Lxc

Asked by John Peacock

I'm trying to set up a Centos 6 instance using lxc and it works fine except that non-root users cannot create pseudo-terminals under /dev/pts. After lots of googling, it appears that Lxc has reverted to an earlier bad behavior, in that /dev/pts is being created with the wrong permissions. I don't know yet whether this is an upstream regression or something specific to the Ubuntu setup. I can tell you that it has nothing to do with the fact that I am trying to run Centos6; I see exactly the same behavior with an Ubuntu 13.4 instance.

HOST
# fgrep pts /proc/mounts
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0

LXC instance
[root@rh64bare ~]# fgrep pts /proc/mounts
devpts /dev/console devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
devpts /dev/tty1 devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
devpts /dev/tty2 devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
devpts /dev/tty3 devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
devpts /dev/tty4 devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
devpts /dev/pts devpts rw,relatime,mode=600,ptmxmode=666 0 0
devpts /dev/ptmx devpts rw,relatime,mode=600,ptmxmode=666 0 0

Note the mode on /dev/pts; only root can create pseudo terminals. I tried to add an explicit devpts line to the instance fstab with the correct parameters, but nothing changed. Additionally, /dev/pts is being created root/root, not root/tty, so the gid=5 (also missing from the /dev/pts options) would have no effect in any case.

Running Ubuntu 13.10 (but saw it with 13.4 as well).

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
John Peacock
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

Could add a chown command in /etc/rc.local above the 'exit 0' line. May help

Revision history for this message
John Peacock (jpeacock) said :
#2

Nope; /dev/pts is mounted readonly and there is nothing I can do within the lxc instance.

Revision history for this message
John Peacock (jpeacock) said :
#3

Looking at the lxc repository, I see this was fixed in lxc-1.0.0.alpha2:

@@ -1306,7 +1427,7 @@ static int setup_pts(int pts)
        }

        if (mount("devpts", "/dev/pts", "devpts", MS_MGC_VAL,
- "newinstance,ptmxmode=0666")) {
+ "newinstance,ptmxmode=0666,mode=0620,gid=5")) {
                SYSERROR("failed to mount a new instance of '/dev/pts'");
                return -1;
        }

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#4

I suggest you report a bug to get the package upgraded.

Revision history for this message
John Peacock (jpeacock) said :
#5