81828e7
From 7afbf6f20e1de62fb5595411d998703c95af8965 Mon Sep 17 00:00:00 2001
81828e7
From: Karel Zak <kzak@redhat.com>
81828e7
Date: Wed, 2 Jan 2013 08:23:00 +0100
81828e7
Subject: [PATCH 1/3] agetty: replace perms 660 to 620
81828e7
81828e7
 ... the default is root:tty 620
81828e7
81828e7
Signed-off-by: Karel Zak <kzak@redhat.com>
81828e7
---
81828e7
 login-utils/login.1 | 5 ++++-
81828e7
 term-utils/agetty.c | 2 +-
81828e7
 2 files changed, 5 insertions(+), 2 deletions(-)
81828e7
81828e7
diff --git a/login-utils/login.1 b/login-utils/login.1
81828e7
index 092213d..e37e5e6 100644
81828e7
--- a/login-utils/login.1
81828e7
+++ b/login-utils/login.1
81828e7
@@ -184,7 +184,10 @@ login failure.  The default value is
81828e7
 (string)
81828e7
 .RS 4
81828e7
 The terminal permissions.  The default value is
81828e7
-.IR 0600 .
81828e7
+.IR 0600
81828e7
+or
81828e7
+.IR 0620
81828e7
+if tty group is used.
81828e7
 .RE
81828e7
 .PP
81828e7
 .B TTYGROUP
81828e7
diff --git a/term-utils/agetty.c b/term-utils/agetty.c
81828e7
index 7ee252d..17ebfba 100644
81828e7
--- a/term-utils/agetty.c
81828e7
+++ b/term-utils/agetty.c
81828e7
@@ -894,7 +894,7 @@ static void open_tty(char *tty, struct termios *tp, struct options *op)
81828e7
 		 * Linux login(1) will change tty permissions. Use root owner and group
81828e7
 		 * with permission -rw------- for the period between getty and login.
81828e7
 		 */
81828e7
-		if (chown(buf, 0, gid) || chmod(buf, (gid ? 0660 : 0600))) {
81828e7
+		if (chown(buf, 0, gid) || chmod(buf, (gid ? 0620 : 0600))) {
81828e7
 			if (errno == EROFS)
81828e7
 				log_warn("%s: %m", buf);
81828e7
 			else
81828e7
-- 
81828e7
1.8.1
81828e7