<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Problem with FTP script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193197#M165136</link>
    <description>Nope, no non display chars, retyped the line and all.&lt;BR /&gt;&lt;BR /&gt;breaking the user line to &lt;BR /&gt;&lt;BR /&gt;user &lt;SNIPPED&gt;&lt;BR /&gt;&lt;PASSWORD&gt;&lt;BR /&gt;&lt;BR /&gt;causes the script to pause and ask for my password.  I can type in the same password in the script and it continues fine and sends the files.&lt;BR /&gt;&lt;BR /&gt;&lt;/PASSWORD&gt;&lt;/SNIPPED&gt;</description>
    <pubDate>Mon, 16 Feb 2004 12:02:56 GMT</pubDate>
    <dc:creator>Sean OB_1</dc:creator>
    <dc:date>2004-02-16T12:02:56Z</dc:date>
    <item>
      <title>Problem with FTP script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193194#M165133</link>
      <description>Hello.  I'm writing a quick script to ftp a bunch of files to all of our servers.  The script fails on login, however I can login fine manually executing the exact command sequence that is in the script.  Any help is appreciated.&lt;BR /&gt;&lt;BR /&gt;Here's the script.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;for SERVER in `cat /tmp/servers`&lt;BR /&gt;do&lt;BR /&gt; echo "FTP to $SERVER"&lt;BR /&gt; sleep 1&lt;BR /&gt; ftp -in  &amp;lt;&amp;lt;-EOF&lt;BR /&gt;  open $SERVER&lt;BR /&gt;  user &lt;USER snipped=""&gt; &lt;PASSWORD snipped=""&gt;&lt;BR /&gt;  ascii&lt;BR /&gt;  lcd /tmp&lt;BR /&gt;  cd /tmp&lt;BR /&gt;  put file1&lt;BR /&gt;  put file2&lt;BR /&gt;  chmod 700 /tmp/file2&lt;BR /&gt;  bye&lt;BR /&gt; EOF&lt;BR /&gt;done&lt;/PASSWORD&gt;&lt;/USER&gt;</description>
      <pubDate>Mon, 16 Feb 2004 11:45:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193194#M165133</guid>
      <dc:creator>Sean OB_1</dc:creator>
      <dc:date>2004-02-16T11:45:17Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with FTP script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193195#M165134</link>
      <description>The nasty part is I don't know any way to check return codes.&lt;BR /&gt;&lt;BR /&gt;Perhaps there is a non-visual junk character in the username or password?&lt;BR /&gt;&lt;BR /&gt;The script looks good.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Mon, 16 Feb 2004 11:52:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193195#M165134</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-02-16T11:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with FTP script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193196#M165135</link>
      <description>Would this work?&lt;BR /&gt;&lt;BR /&gt;for SERVER in `cat /tmp/servers`&lt;BR /&gt;do&lt;BR /&gt;echo "FTP to $SERVER"&lt;BR /&gt;sleep 1&lt;BR /&gt;ftp -in &amp;lt;&amp;lt;-EOF&lt;BR /&gt;open $SERVER&lt;BR /&gt;user &lt;USER snipped=""&gt;&lt;BR /&gt;&lt;PASSWORD snipped=""&gt;&lt;BR /&gt;ascii&lt;BR /&gt;lcd /tmp&lt;BR /&gt;cd /tmp&lt;BR /&gt;put file1&lt;BR /&gt;put file2&lt;BR /&gt;chmod 700 /tmp/file2&lt;BR /&gt;bye&lt;BR /&gt;EOF&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;based on the fact that if a user needs a password, the ftp server will prompt for it with something like&lt;BR /&gt;&lt;BR /&gt;user blah needs a password:&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn [ who would use perl -MNet::FTP ]&lt;/PASSWORD&gt;&lt;/USER&gt;</description>
      <pubDate>Mon, 16 Feb 2004 11:52:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193196#M165135</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2004-02-16T11:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with FTP script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193197#M165136</link>
      <description>Nope, no non display chars, retyped the line and all.&lt;BR /&gt;&lt;BR /&gt;breaking the user line to &lt;BR /&gt;&lt;BR /&gt;user &lt;SNIPPED&gt;&lt;BR /&gt;&lt;PASSWORD&gt;&lt;BR /&gt;&lt;BR /&gt;causes the script to pause and ask for my password.  I can type in the same password in the script and it continues fine and sends the files.&lt;BR /&gt;&lt;BR /&gt;&lt;/PASSWORD&gt;&lt;/SNIPPED&gt;</description>
      <pubDate>Mon, 16 Feb 2004 12:02:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193197#M165136</guid>
      <dc:creator>Sean OB_1</dc:creator>
      <dc:date>2004-02-16T12:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with FTP script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193198#M165137</link>
      <description>Hi Sean,&lt;BR /&gt;&lt;BR /&gt;I would try couple of checks.&lt;BR /&gt;&lt;BR /&gt;1. Try with hardcoding the servername in side the ftp script. Take out the for loop.&lt;BR /&gt;&lt;BR /&gt;2. Run it with -v and look at the session log. See if the password is really being passed.&lt;BR /&gt;&lt;BR /&gt;I copied and pasted your script without the for loop and it is working just fine for me.&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Mon, 16 Feb 2004 12:04:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193198#M165137</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2004-02-16T12:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with FTP script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193199#M165138</link>
      <description>The username is being passwd, and it fails even outside of the for loop.&lt;BR /&gt;&lt;BR /&gt;Here is the result:&lt;BR /&gt;&lt;BR /&gt;root@cosmo0:/tmp-&amp;gt; ./ftp1&lt;BR /&gt;Connected to &lt;SERVER snipped=""&gt;&lt;BR /&gt;220-####################################################&lt;BR /&gt;220-#                                                  #&lt;BR /&gt;220-# This is a restricted server.  Only authorized    #&lt;BR /&gt;220-# users may access this server.  All activity is   #&lt;BR /&gt;220-# monitored and any unauthorized use will be       #&lt;BR /&gt;220-# reported to the appropriate authorities.         #&lt;BR /&gt;220-#                                                  #&lt;BR /&gt;220-####################################################&lt;BR /&gt;220-&lt;BR /&gt;220-&lt;BR /&gt;220 FTP server ready.&lt;BR /&gt;Remote system type is UNIX.&lt;BR /&gt;Using binary mode to transfer files.&lt;BR /&gt;331 Password required for &lt;USERNAME snipped=""&gt;.&lt;BR /&gt;530 Login incorrect.&lt;BR /&gt;Login failed.&lt;BR /&gt;200 Type set to A.&lt;BR /&gt;530 Please login with USER and PASS.&lt;BR /&gt;530 Please login with USER and PASS.&lt;BR /&gt;530 Please login with USER and PASS.&lt;BR /&gt;530 Please login with USER and PASS.&lt;BR /&gt;221 Goodbye.&lt;BR /&gt;&lt;/USERNAME&gt;&lt;/SERVER&gt;</description>
      <pubDate>Mon, 16 Feb 2004 12:08:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193199#M165138</guid>
      <dc:creator>Sean OB_1</dc:creator>
      <dc:date>2004-02-16T12:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with FTP script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193200#M165139</link>
      <description>Hi, &lt;BR /&gt;&lt;BR /&gt;Looks like it didn't like the password. Try with a simple password to test your ftp script.&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Mon, 16 Feb 2004 12:28:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193200#M165139</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2004-02-16T12:28:10Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with FTP script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193201#M165140</link>
      <description>Not all ftp servers are the same. When logging into a solaris ftp server, I got the same result as you... when logging into a linux ftp server your script worked just fine. I would use expect for this.</description>
      <pubDate>Mon, 16 Feb 2004 12:38:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193201#M165140</guid>
      <dc:creator>Paul Cross_1</dc:creator>
      <dc:date>2004-02-16T12:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with FTP script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193202#M165141</link>
      <description>This is the guts of a script I use to send error messages to a central server :-&lt;BR /&gt;&lt;BR /&gt;file=test.txt&lt;BR /&gt;ftplogfile=/tmp/ftplogfile.log&lt;BR /&gt;&lt;BR /&gt;ipaddress=yourhostname&lt;BR /&gt;&lt;BR /&gt;ftp -nv &amp;lt;&lt;EOF 1=""&gt;&amp;gt;$ftplogfile 2&amp;gt;&amp;gt;$ftplogfile&lt;BR /&gt;open $ipaddress&lt;BR /&gt;user username password&lt;BR /&gt;ascii&lt;BR /&gt;cd /remote_directory&lt;BR /&gt;put $file remotefilename&lt;BR /&gt;site chmod 770 remotefilename&lt;BR /&gt;bye&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;You'll need to substitute yourhostname, username, password, remote_directory, remotefilename&lt;BR /&gt;&lt;BR /&gt;Works every time. One thng to watch out for is sometimes indenting the lines between EOF's can upset ftp. I always left justify the block even inside a loop.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Dave.&lt;/EOF&gt;</description>
      <pubDate>Mon, 16 Feb 2004 12:44:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193202#M165141</guid>
      <dc:creator>David Burgess</dc:creator>
      <dc:date>2004-02-16T12:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with FTP script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193203#M165142</link>
      <description>Sean&lt;BR /&gt;&lt;BR /&gt;Run the FTP command with the -i option to disable interactive prompting. Your script with the ID and password on the same line should then work ok.&lt;BR /&gt;&lt;BR /&gt;mark</description>
      <pubDate>Mon, 16 Feb 2004 13:04:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193203#M165142</guid>
      <dc:creator>Mark Greene_1</dc:creator>
      <dc:date>2004-02-16T13:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with FTP script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193204#M165143</link>
      <description>I don't like FTP for the very reason that it is so difficult to script.  And if you do get a script to work, maintenance is difficult (as you've found out). I recommend that you use secure copy instead.  This is secure and it scripts nicely: you can test for return codes, and your script doesn't have to have any passwords in it at all--always a security risk.  Get and install secure copy (ssh) on all your systems.  Its a PITA to configure, but once you get it done, maintenance is negligible.  &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Chris&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 16 Feb 2004 18:07:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193204#M165143</guid>
      <dc:creator>Chris Vail</dc:creator>
      <dc:date>2004-02-16T18:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with FTP script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193205#M165144</link>
      <description>OK, if nobody does it, here's a perl script with a lot of error catching and debugging&lt;BR /&gt;&lt;BR /&gt;Also attached for formatted codeis not supported yet&lt;BR /&gt;&lt;BR /&gt;#!/opt/perl/bin/perl&lt;BR /&gt;&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;&lt;BR /&gt;use Net::FTP;&lt;BR /&gt;&lt;BR /&gt;@ARGV = ("/tmp/servers");&lt;BR /&gt;while (&amp;lt;&amp;gt;) {&lt;BR /&gt;    chomp;&lt;BR /&gt;    my $ftp = Net::FTP-&amp;gt;new ($_, Debug =&amp;gt; 3) or&lt;BR /&gt; die "$_: cannot connect: ", $ftp-&amp;gt;message;&lt;BR /&gt;    $ftp-&amp;gt;login ('user', 'password') or&lt;BR /&gt; die "$_: cannot logon: ", $ftp-&amp;gt;message;&lt;BR /&gt;    $ftp-&amp;gt;ascii or&lt;BR /&gt; die "$_: cannot set ascii mode: ", $ftp-&amp;gt;message;&lt;BR /&gt;    chdir "/tmp" or die "/tmp: $!\n";&lt;BR /&gt;    $ftp-&amp;gt;cwd ("/tmp" or&lt;BR /&gt; die "$_: cannot chdir to /tmp: ", $ftp-&amp;gt;message;&lt;BR /&gt;    foreach my $file (qw( file1 file2 )) {&lt;BR /&gt; $ftp-&amp;gt;put ($file) or&lt;BR /&gt;     die "$_: cannot put $file: ", $ftp-&amp;gt;message;&lt;BR /&gt;    # I have no idea how to do chmod in Net::FTP&lt;BR /&gt;    # chmod 700 /tmp/file2&lt;BR /&gt;    $ftp-&amp;gt;quit;&lt;BR /&gt;    }&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Mon, 16 Feb 2004 18:27:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193205#M165144</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2004-02-16T18:27:27Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with FTP script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193206#M165145</link>
      <description>Some embarrasing typo's is what you get when you post half asleep and don't test.&lt;BR /&gt;&lt;BR /&gt;#!/opt/perl/bin/perl&lt;BR /&gt;&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;&lt;BR /&gt;use Net::FTP;&lt;BR /&gt;&lt;BR /&gt;@ARGV = ("/tmp/servers");&lt;BR /&gt;while (&amp;lt;&amp;gt;) {&lt;BR /&gt;chomp;&lt;BR /&gt;my $ftp = Net::FTP-&amp;gt;new ($_, Debug =&amp;gt; 3);&lt;BR /&gt;$ftp or die "$_: cannot connect: $@";&lt;BR /&gt;$ftp-&amp;gt;login ('user', 'password') or&lt;BR /&gt;die "$_: cannot logon: " . $ftp-&amp;gt;message;&lt;BR /&gt;$ftp-&amp;gt;ascii or&lt;BR /&gt;die "$_: cannot set ascii mode: " . $ftp-&amp;gt;message;&lt;BR /&gt;chdir "/tmp" or die "/tmp: $!\n";&lt;BR /&gt;$ftp-&amp;gt;cwd ("/tmp") or&lt;BR /&gt;die "$_: cannot chdir to /tmp: " . $ftp-&amp;gt;message;&lt;BR /&gt;foreach my $file (qw( file1 file2 )) {&lt;BR /&gt;$ftp-&amp;gt;put ($file) or&lt;BR /&gt;die "$_: cannot put $file: " . $ftp-&amp;gt;message;&lt;BR /&gt;# I have no idea how to do chmod in Net::FTP&lt;BR /&gt;# chmod 700 /tmp/file2&lt;BR /&gt;$ftp-&amp;gt;quit;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Should be better.&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Tue, 17 Feb 2004 04:34:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193206#M165145</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2004-02-17T04:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with FTP script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193207#M165146</link>
      <description>Creating a $HOME/.netrc file has always proved the best among the unattractive options for me in this situation. man 4 netrc</description>
      <pubDate>Tue, 17 Feb 2004 08:26:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-ftp-script/m-p/3193207#M165146</guid>
      <dc:creator>Kirby A. Joss</dc:creator>
      <dc:date>2004-02-17T08:26:14Z</dc:date>
    </item>
  </channel>
</rss>

