You are not logged in.

#1 2006-05-02 13:34:02

Cub69
Member
From: Ottawa, Canada
Registered: 2006-01-20
Posts: 87
Website

Pseudo TTY's -- are they missing?

I use a script to tunnel ppp through ssh because I have a system I maintain that is only accessible via ssh. 

This script was working fine until a recent update -- which one I can't tell you.

I think it might be related to pseudo tty's, which no longer exist in my /dev directory.  I have no /dev/ttyp.. entries -- what creates them?  Should I manually create them, and if I do need to do it manually, what are the parameters I need for mkdev?

Here are the errors:
./ppptochaempip1.pl
running on ttyp0; ssh=4519, pppd=4526
Pseudo-terminal will not be allocated because stdin is not a terminal.
root@10.250.232.18's password:
/usr/bin/pppd: command line: no device specified and stdin is not a tty
[root@lapzilla ~]# starting pppd
/usr/sbin/pppd: unrecognized option '/dev/ttyp0'

If you look at the code, I do use the -t option in ssh to force the tty but that doesn't seem to work because I don't think the devices exist?  Maybe I'm wrong -- not sure.

Here is a snippet of the perl script if it will help:

foreach $maj ("p".."s") { # adjust this to the ptys you have
    foreach $min ("0".."9", "a".."f") {
       &tryopen("$maj$min");
    }
}
die "Couldn't alloc ptyn";

sub tryopen
{
    local($d)=@_;

    if (open(PTY, "+>/dev/pty$d")) {
        $pid=fork;
        defined($pid) || die "can't fork";

        if ($pid) { #parent
            open(STDIN, "<PTY>&PTY") || die "reopen stout";
            close PTY;
            print STDERR "running on tty$d; ssh=$$, pppd=$pidn";
            exec $ssh, "-x", "-t", "-l$sshuser", "$sshhost", "/usr/bin/pppd passive debug";
            die "exec $ssh: $!";

        } else { #child
            close PTY;
            sleep 5;
            print "starting pppdn";
            exec "$pppd /dev/tty$d defaultroute local debug $localip:$remoteip";
            die "exec $pppd: $!";
        }
    }
}

Offline

#2 2006-05-02 13:40:48

rezza
Member
From: Edinburgh, uk
Registered: 2004-07-08
Posts: 237

Re: Pseudo TTY's -- are they missing?

Do you have to use legacy ttys, or will it work with devpts? Do you have devpts in your fstab?

Offline

#3 2006-05-02 13:48:17

Cub69
Member
From: Ottawa, Canada
Registered: 2006-01-20
Posts: 87
Website

Re: Pseudo TTY's -- are they missing?

hmm.. not sure, I didn't write the script, I grabbed it from somewhere on the net --  I could look into finding another one I guess.

My forum search before I posted indicated I needed the entry in fstab -- so I thought I found my problem only to find I did have the entry:

none                   /dev/pts      devpts    defaults            0      0
none                   /dev/shm      tmpfs     defaults            0      0
/dev/cd/cdrom-hdc      /mnt/cd   iso9660   ro,user,noauto,unhide   0      0

Norm[/search]

Offline

Board footer

Powered by FluxBB