So I have looked for an answer to my issue and, pardon me if this has already been answered, but I have written a script that will use SCP to copy a file to a remote server. This is done in the browser and of course I am getting the error
======================
Error: last line returned was: stdin: is not a tty
======================
Here is my code: =======================
!/usr/local/bin/perl use IO::Pty; use CGI qw(:standard); use CGI; use CGI::Carp qw(fatalsToBrowser set_message); use CGI::Carp; # send errors to the browser, not to the logfile use Net::SCP::Expect; use Term::ProgressBar; #use CGI::ProgressBar qw/:standard/; print "Content-type: text/html\n\n"; print "<HTML>"; #print "<H1>Uploading Your File</H1>\n"; my $ipaddress=param("ipaddress"); my $remotepass=param("remotepass"); my $localfile=param("localfile"); my $remotedir=param("remotedir"); my $remoteport=param("remoteport"); my $user="root"; my $filename="./uploads/"; my $file=$filename . $localfile; my $scpe = Net::SCP::Expect->new(host=>$ipaddress, user=>$user, passwo +rd=>$remotepass, port=>$remoteport, auto_yes=> '1', auto_quote=> '0') +; $scpe->scp($file, $remotedir);
=========================
Now I can transfer the file without any issues from a prompt of course, but am unable to do so from the browser.
What I am trying to do here is to allow people who don't know how to use scp or do not have access to a terminal to scp files to a vps (I have my reasons, it's a long story).
I have added the apache user running the script to the root group and was actually able to transfer a file to a random server, but I have been unsuccessful with any other attempt after that.
I am curious if anyone can offer any insight as to how I can work this out.
In reply to SCP and tty by croddam
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |