in reply to Re: Net::FTP Help
in thread Net::FTP Help

Absolutely no idea what you are talking about there:
ftp someserver.com -display your.ip.add.ress:0.0
You seem to be confusing ftp and sh with X apps. FTP (unless you have some goofy replacement ftp client like mftp or something renamed as ftp in your path) is not graphical and the –display flag will just error out on you. Your solution will not work and really does not answer this posters problem.

On to the problem, the original poster is confused between telnet and FTP. FTP is File Transfer Protocol; there is no su command for FTP. You have two (or maybe even more) issues here.

First, Net::FTP will allow you to connect to a remote FTP server and login, upload and download files list directories and so on. If this is not what you are looking for then you need a different module.
Second After reading your question I think I can pull out what your problem is, you are trying to use Net::FTP to connect to a ftp server, you are trying to login to the ftp server as root and since /etc/ftpusers (or wherever the file that accomplishes the same thing is on your ftp server) has a “root” entry you can't log in as root. Why do you need to log in as root? FTP auth is all plain text and anyone on your network could snoop your root password – root login via FTP is a _BAD_ idea. I would take a step back and think about what you are trying to accomplish. Do you really need root access to push or pull the files from that server? If the answer is yes I would consider using the SCP mods to do so. SCP uses encrypted logins and file transfers. If the answer is no I would set up the push or pop locations to be usable by a non system user and do the transfers that way. If you feel like your really _MUST_ login as root directly with FTP then (depending on the ftpd your system uses – some are hard coded not to allow root logins ever) you may edit the file /etc/ftpaccess on the ftp server and remove “root” from the file. That will allow you to login as root with FTP. If you choose the last approach there is something wrong with you. =)

-Waswas

Replies are listed 'Best First'.
Re^3: Net::FTP Help
by cybear (Monk) on Aug 26, 2002 at 16:57 UTC
    Sorry for the confusion... let me be more precise.

    I have effectively beaten the same limitation that is sited in the original post.
    You need to be on a unix/linux workstation running Xwindows, or you need to have
    an Xwindows emulator, such as eXceed, running on your Windows/Mac workstation. Then...

    Write your Perl script to use Net::Telnet. Log in to the remote machine. Then "su" to root, /usr/bin/su - root
    as root have your script start a shell session /usr/bin/sh -display what.every.your.ip
    and pass it the "display" parameter. This WILL send the output from the shell to the IP address
    that you specify.

    Once your shell window opens up on your workstation, you can have your script start ftp. You will be
    starting FTP as root. The main diffrence will be that you must put instead of get.

    disclamer: this will not work "server-to-server". This will only work, as discribed, if you are
    trying to connect from a workstation, running unix/linux, or a workstation running an Xwindows
    emulator... but it absolutely does work.

    - cybear

      Sorry, cybear, but Net::Telnet has the same problem as Net::FTP does: it will send your root password across the wire in clear text.

      If you're going to try to do something like this, please use Net::SSH or Net::SSH::Perl.
      --
      Mike

        That part is absolutely correct... for sure this time. :-)

        - cybear

      bah, let me be more precise.

      [DING!] 1 [~]:msp-mainserver% /usr/bin/sh -display www.myhost.com:0.0 -display: bad option(s) [12:00pm] 2 [~]:msp-mainserver% /usr/bin/ftp -display www.myhost.com:0 +.0 ftp: s: unknown option
      Command line programs dont have a -display command line flag, You are seriously confused. /usr/bin/sh and ftp are not gui on any system I have ever worked on (Solaris, any distro of linux, aix, hpux, irix etc). but it absolutely does work. on what unix? I think not.

      -Waswas
        You know what...

        replace /usr/bin/sh with /usr/openwin/bin/xterm
        been a while...

        sorry about that. But it does work. :-)

        - cybear