Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
do you mean you have ssh connected and are forwarding port 80, and connecting to 127.0.0.1 on the client?
Ftp is different from http, it uses a ramdon port to connect on.
All you need to do is use a remote login and then connect to your server on the internet.
I guess you have no server on the internet and want to access the internal machine using a windows client. If this is the case you can setup http upload using cgi or perl and you could set / or any other folder as the http document root, so you can download anything you want to.
you need to make sure the server is only accessable from the local machine or this would be a gaping hole in your security.
The thing I am trying to say is that the best way to do this is to login to the internal machine, then you can use any method you wish to transfer files and do anything else. This of course requires a server on the internet to transfer files to. Otherwise this is going to become much more complicated. You are going to need to do a lot of configuration of the http server to provide file upload functionality. If however you just want to get files from the internal machine you can just download them. The problem is http is a sloppy protocol for file transfer. Files should probably be put into some zip format before download so they can be verified on the other end when they are unzipped.
You might want to look into scp ( a function of ssh ) as a possible solution if all you need to do is transfer files.
Last edited by DavidPhillips; 03-25-2003 at 01:41 PM.
You see, I'm using a windows version of openssh to make a reversable connection. If ftp wont work, then I just need to configure apache to only allow connections from people who have an account on both ends. You see, my teacher wants me to figure this out, so he can download and upload files from home. but I dont want just anyone from inside the school to go to his website and download files from the my documents folder. At least he would be able to download files from this.
You will need to setup apache to do http uploads and set the doc root or a virtual domain to a folder above where the files are.
You need to block all outside connections to the http server.
The connection to localhost on the client is actually a connection to localhost on the server.
The other choice....
I think there is a windows client for scp
have a look at putty for windows and see if it can do file transfers over the ssh connection.
Last edited by DavidPhillips; 03-25-2003 at 02:35 PM.
my teacher cann't function without a gui, dont ask me why he's our computer engineering teacher either. but he NEEDS a gui. do you know how to set those permissions in apache? I dont mean to be so cumbersome.
#!/usr/bin/perl
BEGIN
{
$SAVE_DIRECTORY = "/var/www/upload";
$MAXIMUM_UPLOAD = 0;
$ALLOW_INDEX = 0;
$SUCCESS_LOCATION = "";
chop $SAVE_DIRECTORY if ($SAVE_DIRECTORY =~ /\/$/);
use CGI qw(:standard);
$query = new CGI;
foreach $key (sort {$a <=> $b} $query->param())
{
next if ($key =~ /^\s*$/);
next if ($query->param($key) =~ /^\s*$/);
next if ($key !~ /^file-to-upload-(\d+)$/);
$Number = $1;
if ($query->param($key) =~ /([^\/\\]+)$/)
{
$Filename = $1;
$Filename =~ s/^\.+//;
$File_Handle = $query->param($key);
if (!$ALLOW_INDEX && $Filename =~ /^index/i)
{
print header;
print <<__END_OF_HTML_CODE__;
<HTML><HEAD><TITLE>Error: Filename Problem</TITLE></HEAD><BODY BGCOLOR=396DA5><H3>Filename Problem</H3><P>You attempted to upload a file that is not properly formatted. The system administrator has decided that you can not upload files that begin with the word '<B>index</B>'. Please rename the file on your computer, and try uploading it again.<P><A HREF="https://www.domain.com">www.domain.com</A> - <A HREF="https://upload.domain.com/upload.html">Upload Files</A> - <A HREF="https://upload.domain.com/">Browse Upload Folder</A></BODY></HTML>
__END_OF_HTML_CODE__
exit;
}
if (!open(OUTFILE, ">$SAVE_DIRECTORY\/$Filename"))
{
print header;
print <<__END_OF_HTML_CODE__;
<HTML><HEAD><TITLE>Error: Filename Exists</TITLE></HEAD><BODY BGCOLOR=396DA5><H3>Filename Problem</H3><P>The filename '<B>$Filename</B>' already exists on the server. The system administrator has decided that you can not overwrite files on this server. Please rename the file on your computer, and try uploading it again.<P><A HREF="https://www.domain.com">www.domain.com</A> - <A HREF="https://upload.domain.com/upload.html">Upload Files</A> - <A HREF="https://upload.domain.com/">Browse Upload Folder</A></BODY></HTML>
__END_OF_HTML_CODE__
exit;
}
undef $BytesRead;
undef $Buffer;
while ($Bytes = read($File_Handle,$Buffer,1024))
{
$BytesRead += $Bytes;
print OUTFILE $Buffer;
}
push(@Files_Written, "$SAVE_DIRECTORY\/$Filename");
$TOTAL_BYTES += $BytesRead;
$Confirmation{$File_Handle} = $BytesRead;
close($File_Handle);
close(OUTFILE);
chmod (0444, "$SAVE_DIRECTORY\/$Filename");
}
fi
}
$FILES_UPLOADED = scalar(keys(%Confirmation));
print header;
print <<__END_OF_HTML_CODE__;
<HTML><HEAD><TITLE>Upload Finished</TITLE></HEAD><BODY BGCOLOR=396DA5><H3>Upload Finished</H3><P>You uploaded <B>$FILES_UPLOADED</B> files totalling <B>$TOTAL_BYTES</B> total bytes. Individual file information is listed below:<PRE>
__END_OF_HTML_CODE__
foreach $key (keys (%Confirmation))
{
print "$key - $Confirmation{$key} bytes\n";
}
print <<__END_OF_HTML_CODE__;
</PRE><P><A HREF="https://www.domain.com">www.domain.com</A> - <A HREF="https://upload.domain.com/upload.html">Upload Files</A> - <A HREF="https://upload.domain.com/">Browse Upload Folder</A></BODY></HTML>
__END_OF_HTML_CODE__
exit;
}
# ---------------------------------------------------------------------
# EOF
Last edited by DavidPhillips; 03-25-2003 at 04:45 PM.
I dont have perl on the computer because both computers are running Windows XP. I trust linux software above any other, and believe the linux programmers know exactly what they're doing. However, I need this cabability from two windows computers. I installed a windows version of openssh and apache. That is why sftp didn't work, and I needed apache to do the file management. But this means that the cgi script you gave me wont work. Is there another way to upload files to my windows apache web server?
The situation has changed from when I first started this thread. At first I wanted to access my server at home, now my teacher wants to access his windows xp computer at home, with the best security possible. The windows version of openssh does support sftp, only remote command prompt. But it the thing you said first about the ssh -R 8080:localhost:8080 <ip of home compuer> worked, and now I want to send files back and forth between the two computers. I tried IIS ftp, but it wouldn't work because it gave invalid syntax commands. I tried IIS web server, but could only get the anonymous user to work. I need more security. So I downloaded the new appache web server for windows and installed it. Now I have apache working on port 8080, and it denys everyone but 127.0.0.1, however, I now needs a means of having the web server upload files from the home computer, back to the <hidden behind school routers> work computer. I looked at your upload.cgi script, and noticed you were using perl for uploads. When I try to upload files, it just times out. I need another cgi script that is compatible with windows software. Thank you so much for your help so far!!!!!!!!!!!!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.