Home | History | Annotate | Download | only in openssh

Lines Matching refs:tty

6  * Allocating a pseudo-terminal, and making it the controlling tty.
59 * descriptors for the pty and tty sides and the name of the tty side are
88 /* Releases the tty. Its ownership is returned to root, and permissions to 0666. */
91 pty_release(const char *tty)
94 if (chown(tty, (uid_t) 0, (gid_t) 0) < 0)
95 error("chown %.100s 0 0 failed: %.100s", tty, strerror(errno));
96 if (chmod(tty, (mode_t) 0666) < 0)
97 error("chmod %.100s 0666 failed: %.100s", tty, strerror(errno));
101 /* Makes the tty the process's controlling tty and sets it to sane modes. */
104 pty_make_controlling_tty(int *ttyfd, const char *tty)
115 fd = open(tty, O_RDWR|O_NOCTTY);
123 error("Failed to disconnect from controlling tty.");
126 debug("Setting controlling tty using TCSETCTTY.");
128 fd = open("/dev/tty", O_RDWR);
130 error("%.100s: %.100s", tty, strerror(errno));
135 /* First disconnect from the old controlling tty. */
148 * tty.
152 error("Failed to disconnect from controlling tty.");
155 /* Make it our controlling tty. */
157 debug("Setting controlling tty using TIOCSCTTY.");
170 fd = open(tty, O_RDWR);
172 error("%.100s: %.100s", tty, strerror(errno));
181 /* Verify that we now have a controlling tty. */
184 error("open /dev/tty failed - could not set controlling tty: %.100s",
208 pty_setowner(struct passwd *pw, const char *tty)
215 /* Determine the group to make the owner of the tty. */
216 grp = getgrnam("tty");
226 * Change owner and mode of the tty as required.
228 * tty is owned by root.
230 if (stat(tty, &st))
231 fatal("stat(%.100s) failed: %.100s", tty,
235 ssh_selinux_setup_pty(pw->pw_name, tty);
239 if (chown(tty, pw->pw_uid, gid) < 0) {
243 tty, (u_int)pw->pw_uid, (u_int)gid,
247 tty, (u_int)pw->pw_uid, (u_int)gid,
253 if (chmod(tty, mode) < 0) {
257 tty, (u_int)mode, strerror(errno));
260 tty, (u_int)mode, strerror(errno));