Gossamer Forum
Home : General : Perl Programming :

Telnet and File Uploads

Quote Reply
Telnet and File Uploads
Hi All

Is there any way to use Telnet (or its more secure cousin - SecureCRT) to upload scripts from my local machine? It would be nice to move away from FTP if possible.

Thanks very much. Smile

DT

Quote Reply
Re: Telnet and File Uploads In reply to
You can use FTP through Telnet/SSH

While logged into your SSH account, type:

ftp <enter>

ftp> open <enter>
ftp> (to) www.yoururl.com

Then it will say something like:

Connected to www.youruurl.com.
220 ProFTPD 1.2.0rc3 Server (Paul's FTP Server) [66.59.133.14]
Name (www.yourserver.com:admin):

I can't think of any other efficient way.

Installations:http://www.wiredon.net/gt/

Quote Reply
Re: Telnet and File Uploads In reply to
There is a program called "scp" which copies files over ssh. For example, on my system I can run the command:
Code:
scp jagerman@jagerman.com:ss.jpeg ss.jpeg
And, after asking for my password, it will copy the "ss.jpg" file from my home directory on jagerman.com to my local computer, using ssh.

The catch is that I don't have SecureCRT installed on my computer, so I can't tell you whether or not SecureCRT supports secure copying like this.

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: Telnet and File Uploads In reply to
Thank you both so much. I'm gonna try what you suggested and see how far I get. I really appreciate your help.

SmileSmile

DT

Quote Reply
Re: Telnet and File Uploads In reply to
Okay, I tried what Paul suggested using SecureCRT, and I managed to connect. Here's what I got:

In Reply To:
[myserver@myserver userid]$ ftp
ftp> open
(to) www.myserver.com
Connected to www.myserver.com.
220 armynavy FTP server (Version wu-2.6.0(1) Mon Feb 28 10:30:36 EST 2000) ready.
Name (www.myserver.com:userid): <ENTER>
331 Password required for userid.
Password:
230 User userid logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
Then, I typed "ls" (without quotes) thinking that I would be shown what files are available at that location, and I was given the following:

In Reply To:
ftp> ls
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
total 1552
-rw------- 1 root root 584 Mar 4 07:01 .ICEauthority
-rw------- 1 root root 979 Mar 4 07:01 .Xauthority
-rw-r--r-- 1 root root 1126 Aug 23 1995 .Xdefaults
-rw------- 1 root root 5929 Jul 23 12:54 .bash_history
-rw-r--r-- 1 root root 24 Jul 13 1994 .bash_logout
-rw-r--r-- 1 root root 238 Aug 23 1995 .bash_profile
-rw-r--r-- 1 root root 176 Aug 23 1995 .bashrc
-rw-r--r-- 1 root root 182 Mar 21 1999 .cshrc
drwx------ 3 root root 4096 Mar 4 07:03 .enlightenment
drwxr-xr-x 7 root root 4096 Mar 4 07:01 .gnome
drwxr-xr-x 2 root root 4096 Sep 25 2000 .gnome-desktop
drwxr-xr-x 2 root root 4096 Sep 22 2000 .gnome-help-browser
drwx------ 2 root root 4096 Sep 22 2000 .gnome_private
-rw-r--r-- 1 root root 1662 Sep 26 2000 .gxedit
-rw-r--r-- 1 root root 654 Sep 26 2000 .gxedit.applications
drwxr-xr-x 3 root root 4096 Dec 20 1998 .kde
-rw-r--r-- 1 root root 709 Nov 1 2000 .kderc
drwxr-xr-x 2 root root 4096 Dec 31 2000 .mc
-rw------- 1 root root 16 Mar 4 06:50 .mysql_history
drwxr-xr-x 2 root root 4096 Sep 27 2000 .ncftp
drwxr-xr-x 5 root root 4096 Dec 31 2000 .netscape
-rw-r--r-- 1 root root 42 Sep 27 2000 .saves-1446-armynavy~
-rw-r--r-- 1 root root 166 Mar 4 1996 .tcshrc
-rw------- 1 root root 485 Oct 14 2000 .viminfo
drwxr-xr-x 2 root root 4096 Nov 1 2000 .vnc
drwx------ 3 root root 4096 Sep 27 2000 .xauth
-rw------- 1 root root 850 Sep 25 2000 .xsession-errors
drwxr-xr-x 5 root root 4096 Sep 22 2000 Desktop
drwx------ 2 root root 4096 Sep 27 2000 Mail
-rw------- 1 root root 1458176 Sep 27 2000 core
drwx------ 2 root root 4096 Sep 22 2000 nsmail
226 Transfer complete.
Honestly, I don't have a clue what just happened.

I don't know where the copies of those files went (or even which direction), and I'm not sure how to navigate to files on my local windows machine to upload them to my remote server while I'm in the ftp mode.

Am I at least somewhat going in the right direction?

Many thanks for your help. Smile

DT

Quote Reply
Re: Telnet and File Uploads In reply to
That is fine, you didn't delete anything...

You either use ls or dir to list files and directories within your current directory.

Use cd to change directory

Use get and put to transfer file

You can type help for more info.

Mods:http://wiredon.net/gt/download.shtml
Installs:http://wiredon.net/gt/


Quote Reply
Re: Telnet and File Uploads In reply to
Using a a text based ftp program to access the computer you are working on seems like a lot of work.

I graphical ftp client would do the same thing.

Quote Reply
Re: Telnet and File Uploads In reply to
Okay, I think I'm almost there. I got in, opened ftp, then here is what happened next:

In Reply To:
ftp> open
(to) www.mysite.com
Connected to mysite.com.
220-
220-Welcome to mysite.com!
220-
220 mysite.com FTP server (Version wu-2.5.0(1) Wed Aug 25 18:14:49 GMT 1999) ready.
Name (www.mysite.com:userid):
331 Password required for userid.
Password: <ENTER>
230 User userid logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> get
(remote-file) C:\test\test.html
(local-file) /home/mysite/www/testcgi/
local: /home/mysite/www/testcgi/ remote: C:testtest.html
200 PORT command successful.
550 C:testtest.html: No such file or directory.
What I thought I was doing is directing the server to a file on my local machine and then telling it where to put it on the server. I know for sure that both of the things that I entered as (remote-file) and (local-file) exist, but I keep getting the "550" thing - no such file or directory.

In Reply To:
550 C:testtest.html: No such file or directory.
I'm also not sure why the C:\test\test.html file gets scrunched up to look like C:testtest.html

I know I'm close, and man this will be great if I can do it. In fact, this is the kind of thing that everyone should know.

BTW, once I get this thing figured out, how would I change the transfer mode from binary to ascii? It seems to default to binary and not offer options.

Thanks, again, for your help. Smile

DT

Quote Reply
Re: Telnet and File Uploads In reply to
Hi,

If your server supports it, just ssh into your server and then type:

rz

at the prompt and SecureCRT will pop up a file upload box, enter in the files you want to upload and hit send.

You can download by typing:

sz filenam.txt

and it will download the file. If you don't have the rz/sz tools installed, ask your ISP to put them on! It's so conveienant (and secure as it all goes through ssh, where ftp is plain text).

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Telnet and File Uploads In reply to
Wowsee, wow!

It works!

Okay, let me add a little to Alex's comments:

1. After you ssh into the server, first NAVIGATE TO THE DIRECTORY that you want to upload the files, etc., to. If you simply ssh in and don't navigate, you'll upload your file to the top level that you have permissions to enter.

2. On my SecureCRT 3.1, I don't have a "Send" button. Rather, after I type in rz and then press enter, I get a window with 2 boxes, one upper, the other lower. In the upper box, you navigate on your local machine to the file that you want to upload, then next to the lower box there is a button that says, "Add". You can either double click the file in the upper box to auto-add it to the lower box, or you can single click in the upper, and then hit the Add button.

It doesn't upload/download whole directories, like FTP, but you can add multiple file selections, at least in upload.

In either case, once I've added all the stuff that I want to upload, I simply hit the "Close" button, and then the upload takes place automatically.

Super!!!!!!!

So:

1. ssh
2. navigate to the receiving directory on the server
3. type in rz and then hit enter
4. navigate to the files on your local machine that you want to upload
5. add them to the box
6. hit "Close"

My guess is that you probably have a more recent version than I do, Alex. That's why I'm including what worked for mine.

Man, I've been needing something like this forever. I hope that everyone can take advantage of this now EZ-2-USE way of uploading securely.

I also have a question about the sz command. I first navigated to the remote file that I wanted to download. Then I typed in:

sz test.html

and then hit enter. The thing downloaded, but I was never given any download options. I found the file in the download directory in the SecureCRT directory:

C:\Program Files\SecureCRT\download\test.html

...just in case you want to know where the heck it went.

Also, what about the transfer mode? Ascii or binary? In either the upload or download, I didn't get any options.

Thanks, one and all!!!!

DT SmileSmileSmile

Quote Reply
Re: Telnet and File Uploads In reply to
Hi,

That's the best thing about SecureCRT is it's built in support for zmodem transfer (sz and rz stand for send zmodem, receive zmodem).

It transfers all the files in BINARY mode (i.e. no changes to the file). So if you upload a perl script with windows line feeds, you'll need to change it to unix linefeeds first. You can do this with:

perl -p -i -e 's/\r\n/\n/g' filename.cgi

which will replace windows linefeeds with unix linefeeds on filename.cgi.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Telnet and File Uploads In reply to
Many thanks for your help with this, Alex. Sorry for so long responding. This is a great tool!

DogTags