From: <ha...@no...> - 2002-05-16 15:18:59
|
> In the mean time you could probably get away with adding a setgpid(0, getpid()) > in to openssh source where it opens the controlling tty, I suspect this will > fix bash but won't do squat for TIOCSCTTY.. > > - Wilton I recompiled sshd with this change (supposing you ment setpgid(), not setgpid() ?): openssh-3.1p1, sshpty.c: /* ADDED BY VACLAV HANZL */ debug("Trying to avoid bproc problems with TIOCSCTTY by setpgid(0, getpid())."); if (setpgid(0, getpid()) < 0) error("setpgid(0, getpid()): %.100s", strerror(errno)); /* END OF PART ADDED BY VACLAV HANZL */ debug("Setting controlling tty using TIOCSCTTY."); if (ioctl(*ttyfd, TIOCSCTTY, NULL) < 0) error("ioctl(TIOCSCTTY): %.100s", strerror(errno)); Unfortunately, setpgid() fails as well: n1 sshd[19998]: error: setpgid(0, getpid()): Operation not permitted n1 sshd[19998]: error: ioctl(TIOCSCTTY): Operation not permitted However now I can easily add any debug prints to sshd. Suggestions for things to test are welcome. I guess TIOCSCTTY fails because kernel does not consider the process to be a session leader: in kernel, drivers/char/tty_io.c: case TIOCSCTTY: return tiocsctty(tty, arg); int tiocsctty(...) ... static int tiocsctty(struct tty_struct *tty, int arg) { if (current->leader && (current->session == tty->session)) return 0; /* * The process must be a session leader and * not have a controlling tty already. */ if (!current->leader || current->tty) return -EPERM; Any hints welcome, I continue my effort on this... Best Regards Vaclav On Tue, 14 May 2002, ha...@no... wrote: > Dear BProc users and gurus, > > I am trying to setup occasional master->slave OpenSSH access (just for > the convenience of environment, pty etc. during service work on slave > node). > > It works but it cannot use controlling tty. Server process complains: > > n1 sshd[19675]: error: ioctl(TIOCSCTTY): Operation not permitted > n1 sshd[19675]: error: open /dev/tty failed - could not set controlling tty: No such device or address > > and client process complains: > > bash: initialize_job_control: setpgid: Operation not permitted > > Then it works OK, just job control is missing. Server process is able > to use /dev/ptmx to allocate /dev/pts/0, it opens /dev/tty but then it > is unable to use it. This seemes strange to me. > > At this moment I am not sure whether I should continue looking for > missing files, kernel modules etc. on slave node (usual game when you > insist on running some daemon :-) or delve into kernel sources and > look for strange interactions of BProc and controlling tty. > > > So, my only question is: Is it likely that controlling terminal things > are a bit broken in BProc patched kernel? > > Just give me some opinions to let me search in more likely > directions... > > Thanks > > Vaclav Hanzl |