Welcome to the Linux Foundation Forum!

Background Programs - & and ENV Var's in PERL

Background Programs - & and ENV{} Var's in PERL

Hi, I've been recently implementing a program that will access incoming data by forwarding data from an ip address to a local port and gathering that data, using these commands.

ssh -l ec34 -L 12345:127.0.0.1:10237 192.101.77.209 -n

Unfortunately this command takes up the command line, and when i add a '&' to it, I get the error:

Pseudo-terminal will not be allocated because stdin is not a terminal.

A wise friend of mine suggested looking into Environment Variables and modify one. I used the code:

foreach $key (sort keys(%ENV)) {

print "$key = $ENV{$key}

n";

}

To display these variables, but found nothing I felt I could use against this error. I'm thinking I may be missing a parameter in the `ssh...` command once I have added an ampersand & to it, or I have now confused it into thinking it's going to output into standard in (possibly as a default for the background), and I dont know why. Does anyone know how I can connect this data to a local port behind the scenes?

Comments

  • Posts: 158
    It sounds like you just want the ssh session to run int he back ground.
    1. ssh -f -N -L 12345:127.0.0.1:10237 ec34@192.101.77.209

    that should do exactly what you want, if I understand your concerns correctly.
  • Hi gomer,

    What I have been doing is using this ssh command from my last post,

    ssh -l ec34 -L 12345:127.0.0.1:10237 192.101.77.209 -n

    to forward my incoming data to a port, and read off this port with:

    netcat -t localhost 12345

    Once I implemented your code after closing the current ssh linkup I had going, the code ran in correctly, but when I tried to netcat it I got this error message - "channel 2: open failed: administratively prohibited: open failed".
    I'm unsure what exactly your command does, yet, and i'm fairly certain this is possible without admin privileges. Hopefully you can help me out!

    John

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training