tty[1-6] is now root:tty 0660 instead of root:root 0600
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Util-Linux-ng |
Fix Released
|
Undecided
|
Unassigned | ||
util-linux (Ubuntu) |
Fix Released
|
Medium
|
Unassigned |
Bug Description
As of precise (2.20.1-1ubuntu3 to be exact), /dev/tty[1-6] now has the following permissions:
$ ls -l /dev/tty[1-6]
crw-rw---- 1 root tty 4, 1 Apr 12 13:06 /dev/tty1
crw-rw---- 1 root tty 4, 2 Apr 12 13:06 /dev/tty2
crw-rw---- 1 root tty 4, 3 Apr 12 13:06 /dev/tty3
crw-rw---- 1 root tty 4, 4 Apr 12 13:06 /dev/tty4
crw-rw---- 1 root tty 4, 5 Apr 12 13:06 /dev/tty5
crw-rw---- 1 root tty 4, 6 Apr 12 13:06 /dev/tty6
In 11.10 and earlier (I checked back to hardy), the permissions were:
$ ls -l /dev/tty[1-6]
crw------- 1 root root 4, 1 2012-03-25 09:18 /dev/tty1
crw------- 1 root root 4, 2 2012-03-25 09:17 /dev/tty2
crw------- 1 root root 4, 3 2012-03-25 09:17 /dev/tty3
crw------- 1 root root 4, 4 2012-03-25 09:17 /dev/tty4
crw------- 1 root root 4, 5 2012-03-25 09:17 /dev/tty5
crw------- 1 root root 4, 6 2012-03-25 09:17 /dev/tty6
This appears to be because of this util-linux commit:
http://
I'm not sure if this is a problem, but it isn't clear why the change was made and I'm having a hard time knowing why the group was changed. This is the bit of code that I think is the cause:
+ /*
+ * There is always a race between this reset and the call to
+ * vhangup() that s.o. can use to get access to your tty.
+ * Linux login(1) will change tty permissions. Use root owner and group
+ * with permission -rw------- for the period between getty and login.
+ */
+ if (chown (buf, 0, gid) || chmod (buf, (gid ? 0660 : 0600))) {
+ if (errno == EROFS)
+ log_warn("%s: %m", buf);
+ else
+ log_err("%s: %m", buf);
+ }
There might not be anything to do with this, but I am filing it to get other's opinions.
Changed in util-linux (Ubuntu): | |
importance: | Undecided → Medium |
affects: | util-linux (Ubuntu) → linux (Ubuntu) |
affects: | linux (Ubuntu) → util-linux (Ubuntu) |
Changed in util-linux (Ubuntu): | |
status: | New → Confirmed |
tags: | added: kernel-da-key precise |
Changed in util-linux (Ubuntu): | |
status: | Confirmed → Fix Released |
This is actually the code responsible:
@@ -686,12 +770,16 @@ static void open_tty(char *tty, struct termios *tp, struct options *op)
log_err( "%s: tcgetattr: %m", tty);
/* result( chown(tty, 0, 0)); result( chmod(tty, 0600)); STDIN_FILENO, TIOCMGET, &serial) < 0 && (errno = EINVAL)) {
- * Linux login(1) will change tty permissions. Use root owner and group
- * with permission -rw------- for the period between getty and login.
+ * Detect if this is a virtual console or serial/modem line.
+ * In case of a virtual console the ioctl TIOCMGET fails and
+ * the error number will be set to EINVAL.
*/
- ignore_
- ignore_
- errno = 0;
+ if (ioctl(
+ op->flags |= F_VCONSOLE;
+ if (!op->term)
+ op->term = DEFAULT_VCTERM;
+ } else if (!op->term)
+ op->term = DEFAULT_STERM;
}