.RS 4
The terminal permissions. The default value is 0600.
.RE
+.PP
+\fBTTYGROUP\fR (string)
+.RS 4
+The login tty will be owned by the
+\fBTTYGROUP\fR. The default value is 'tty'. If the \fBTTYGROUP\fR does not exist
+then the ownership of the terminal is set to the user\'s primary group.
+.SP
+The \fBTTYGROUP\fR can be either the name of a group or a numeric group identifier.
+.RE
.SH FILES
.nf
static void chown_tty(struct login_context *cxt)
{
- struct group *gr;
+ const char *grname;
uid_t uid = cxt->pwd->pw_uid;
gid_t gid = cxt->pwd->pw_gid;
- gr = getgrnam(TTYGRPNAME);
- if (gr)
- gid = gr->gr_gid;
+ grname = getlogindefs_str("TTYGROUP", TTYGRPNAME);
+ if (grname && *grname) {
+ if (*grname >= 0 && *grname <= 9) /* group by ID */
+ gid = getlogindefs_num("TTYGROUP", gid);
+ else { /* group by name */
+ struct group *gr = getgrnam(grname);
+ if (gr)
+ gid = gr->gr_gid;
+ }
+ }
if (fchown(0, uid, gid)) /* tty */
chown_err(cxt->tty_name, uid, gid);