<?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: sftp script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173616#M682209</link>
    <description>&lt;!--!*#--&gt;Mel Burslan ,&lt;BR /&gt;  How to get the string?&lt;BR /&gt;&lt;BR /&gt;Court Campbell,&lt;BR /&gt;  My goal is to copy one file across the network. How can I change this one in to scp? That should not ask username and password( means automatic file transfer) &lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Davis Paul&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 06 May 2009 13:35:15 GMT</pubDate>
    <dc:creator>Davis Paul</dc:creator>
    <dc:date>2009-05-06T13:35:15Z</dc:date>
    <item>
      <title>sftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173611#M682204</link>
      <description>&lt;!--!*#--&gt;Hi All&lt;BR /&gt; I have a script as follows:&lt;BR /&gt;&lt;BR /&gt;cat script1&lt;BR /&gt;#!/usr/local/bin/expect&lt;BR /&gt;spawn sftp -v root@192.168.55.242&lt;BR /&gt;expect "password:"&lt;BR /&gt;send "root123\n";&lt;BR /&gt;interact&lt;BR /&gt;&lt;BR /&gt; This will work up to sftp prompt. I need to add three sftp command&lt;BR /&gt; 1) cd /var&lt;BR /&gt; 2)put star.txt&lt;BR /&gt; 3) bye&lt;BR /&gt;&lt;BR /&gt; Where I can add these three commands in above scripts?&lt;BR /&gt;&lt;BR /&gt;Thanks and regards&lt;BR /&gt;Davis Paul&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 06 May 2009 12:28:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173611#M682204</guid>
      <dc:creator>Davis Paul</dc:creator>
      <dc:date>2009-05-06T12:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: sftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173612#M682205</link>
      <description>after send "root123\n" line you will need to expect a string telling you that you logged in successfully as root. I am not sure what this string will be. you need to login manually to get the string from the session log. then you can enter your commands after the expect line as follows:&lt;BR /&gt;&lt;BR /&gt;expect "my successful login string here"&lt;BR /&gt;cd /var&lt;BR /&gt;put star.txt&lt;BR /&gt;bye&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;HTH</description>
      <pubDate>Wed, 06 May 2009 13:14:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173612#M682205</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2009-05-06T13:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: sftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173613#M682206</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;I would setup public SSH keys and do something like I do in this thread:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1308338" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1308338&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 06 May 2009 13:21:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173613#M682206</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-05-06T13:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: sftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173614#M682207</link>
      <description>I am not sure what your goal is. But if you are only going to copy one file across the network, you could just use scp.</description>
      <pubDate>Wed, 06 May 2009 13:25:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173614#M682207</guid>
      <dc:creator>Court Campbell</dc:creator>
      <dc:date>2009-05-06T13:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: sftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173615#M682208</link>
      <description>Hi Davis Paul,&lt;BR /&gt;&lt;BR /&gt;keeping the root password in script or any text file is not a secure way. &lt;BR /&gt;&lt;BR /&gt;You can simply configure ssh password less login between source and destination server and write a simple script to transfer the files like below.&lt;BR /&gt;&lt;BR /&gt;#--------------------------------------------&lt;BR /&gt;# Connect to server and put the files&lt;BR /&gt;#--------------------------------------------&lt;BR /&gt;sftp root@193.23.116.107 &amp;lt;&amp;lt;**&lt;BR /&gt;lcd &lt;LOCAL directory="" path=""&gt;&lt;BR /&gt;cd /var&lt;BR /&gt;put star.txt&lt;BR /&gt;**&lt;BR /&gt;&lt;/LOCAL&gt;</description>
      <pubDate>Wed, 06 May 2009 13:34:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173615#M682208</guid>
      <dc:creator>Ganesan R</dc:creator>
      <dc:date>2009-05-06T13:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: sftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173616#M682209</link>
      <description>&lt;!--!*#--&gt;Mel Burslan ,&lt;BR /&gt;  How to get the string?&lt;BR /&gt;&lt;BR /&gt;Court Campbell,&lt;BR /&gt;  My goal is to copy one file across the network. How can I change this one in to scp? That should not ask username and password( means automatic file transfer) &lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Davis Paul&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 06 May 2009 13:35:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173616#M682209</guid>
      <dc:creator>Davis Paul</dc:creator>
      <dc:date>2009-05-06T13:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: sftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173617#M682210</link>
      <description>Court&amp;gt; But if you are only going to copy one file across the network, you could just use scp.&lt;BR /&gt;&lt;BR /&gt;Not necessarily.  I have to exchange one file a day with an external vendor using their sFTP server, and they will *NOT* allow me to just scp the sucker.  I had to dance the Key Exchange Dance and am forced to use sftp and ONLY sftp for the transfers.  Resulting in a long-ish back-and-forth script.  For ONE file.  :-(&lt;BR /&gt;&lt;BR /&gt;(Can you tell that having to jump thru eleventy-bazillion hoops to transfer a single file that could be sent in one easy step has me Somewhat Annoyed?)</description>
      <pubDate>Wed, 06 May 2009 13:36:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173617#M682210</guid>
      <dc:creator>Michael Mike Reaser</dc:creator>
      <dc:date>2009-05-06T13:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: sftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173618#M682211</link>
      <description>&lt;!--!*#--&gt;Hi &lt;BR /&gt;  I cannot create a password less login . Because the destination server control is not in our hand.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Davis</description>
      <pubDate>Wed, 06 May 2009 13:39:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173618#M682211</guid>
      <dc:creator>Davis Paul</dc:creator>
      <dc:date>2009-05-06T13:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: sftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173619#M682212</link>
      <description>Hi Again,&lt;BR /&gt;&lt;BR /&gt;Follow these steps to configure ssh password less login.&lt;BR /&gt;&lt;BR /&gt;1.Login to serverA as user1.&lt;BR /&gt;&lt;BR /&gt;2.$ssh-keygen -t dsa&lt;BR /&gt;  Press enter for all the questions.It will create the private/public keys &lt;BR /&gt; under $HOME/.ssh/&lt;BR /&gt; File names are id_rsa and id_rsa.pub&lt;BR /&gt;&lt;BR /&gt;3.Now you need to copy the id_rsa.pub file content into ServerB $HOME/.ssh/authorized_keys file &lt;BR /&gt; ServerA#scp ~user1/.ssh/id_rsa.pub ServerB:/tmp&lt;BR /&gt;&lt;BR /&gt;Login to ServerB server&lt;BR /&gt;&lt;BR /&gt; ServerB#cat /tmp/id_rsa.pub &amp;gt;&amp;gt; ~user1/.ssh/authorized_keys&lt;BR /&gt;&lt;BR /&gt;Make sure the following permissions on serverB.&lt;BR /&gt;&lt;BR /&gt;Home directory should have 755 permission (users home directory)&lt;BR /&gt;$HOME/.ssh directory should have 700 permission&lt;BR /&gt;$HOME/.ssh/authorized_keys file should have 600 permission&lt;BR /&gt;</description>
      <pubDate>Wed, 06 May 2009 13:40:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173619#M682212</guid>
      <dc:creator>Ganesan R</dc:creator>
      <dc:date>2009-05-06T13:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: sftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173620#M682213</link>
      <description>The answer to your "how to get the string" depends on your server configuration. &lt;BR /&gt;&lt;BR /&gt;Using an interactove session, not the script, login to the destination server.&lt;BR /&gt;&lt;BR /&gt;watch the screen after you enter the password, and note the last line printed on the screen. That should be your expect string. My servers do not say anything upon successful login, so I can skip that expect statement if I were to  use your script, but you might (or might not) need it.</description>
      <pubDate>Wed, 06 May 2009 13:45:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173620#M682213</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2009-05-06T13:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: sftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173621#M682214</link>
      <description>Hi Davis Paul,&lt;BR /&gt;&lt;BR /&gt;If you cannot have ssh password less login, and afford to use ftp instead of sftp follow the below steps.&lt;BR /&gt;&lt;BR /&gt;1.Put a entry in root .netrc file like this.&lt;BR /&gt;&lt;BR /&gt;#vi /.netrc&lt;BR /&gt;machine 192.168.55.242 login root passwd root123&lt;BR /&gt;&lt;BR /&gt;2.Your script should be like this&lt;BR /&gt;&lt;BR /&gt;#--------------------------------------------&lt;BR /&gt;#  Connect to 192.168.55.242 and put the file&lt;BR /&gt;#--------------------------------------------&lt;BR /&gt;ftp &amp;lt;&amp;lt;**&lt;BR /&gt;open 192.168.55.242 &lt;BR /&gt;lcd /path&lt;BR /&gt;cd /var&lt;BR /&gt;bin&lt;BR /&gt;put star.txt&lt;BR /&gt;bye&lt;BR /&gt;**&lt;BR /&gt;#--------------------------------------------&lt;BR /&gt;&lt;BR /&gt;This will work. But note that this is plain transfer not like sftp which is more secure.</description>
      <pubDate>Wed, 06 May 2009 13:50:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173621#M682214</guid>
      <dc:creator>Ganesan R</dc:creator>
      <dc:date>2009-05-06T13:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: sftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173622#M682215</link>
      <description>&lt;!--!*#--&gt;&lt;BR /&gt;Mel Burslan,&lt;BR /&gt;&lt;BR /&gt;nothing is printed as below:  &lt;BR /&gt;&lt;BR /&gt;# sftp root@192.168.55.242&lt;BR /&gt;Connecting to 192.168.55.242...&lt;BR /&gt;Password:&lt;BR /&gt;sftp&amp;gt;&lt;BR /&gt;sftp&amp;gt; bye&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Then , how to edit the script???&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 06 May 2009 13:58:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173622#M682215</guid>
      <dc:creator>Davis Paul</dc:creator>
      <dc:date>2009-05-06T13:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: sftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173623#M682216</link>
      <description>then modify your script as follows:&lt;BR /&gt;&lt;BR /&gt;#!/usr/local/bin/expect&lt;BR /&gt;spawn sftp -v root@192.168.55.242&lt;BR /&gt;expect "password:"&lt;BR /&gt;send "root123\n";&lt;BR /&gt;interact&lt;BR /&gt;cd /var&lt;BR /&gt;put star.txt&lt;BR /&gt;bye&lt;BR /&gt;&lt;BR /&gt;Note that you are trusting the system that it logged you in successfully. If your login has failed, unpredictable implications may occur. Hence, use it at your own risk.</description>
      <pubDate>Wed, 06 May 2009 14:07:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173623#M682216</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2009-05-06T14:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: sftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173624#M682217</link>
      <description>Mike Reaser,&lt;BR /&gt;&lt;BR /&gt;Thanks for the 2 cent comment, but there is a difference in a suggestion and a definitive answer. If you read carefully you would notice that I stated I did not know what DP's goal is.&lt;BR /&gt;&lt;BR /&gt;And to answer your quesiton DP. Just setup a priv/pub key that has no passphrase. Then put the pub key in the aurthorized key file on the remove server. Then you could just&lt;BR /&gt;&lt;BR /&gt;scp /your/file remote_server:/remote/directory&lt;BR /&gt;&lt;BR /&gt;But as Mike has pointed out that mayu not work for your situation. since this is a simple one liner you could easily add it to a crontab.</description>
      <pubDate>Wed, 06 May 2009 18:19:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173624#M682217</guid>
      <dc:creator>Court Campbell</dc:creator>
      <dc:date>2009-05-06T18:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: sftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173625#M682218</link>
      <description>DP said:&lt;BR /&gt;&lt;BR /&gt;"nothing is printed as below:  &lt;BR /&gt;&lt;BR /&gt;# sftp root@192.168.55.242&lt;BR /&gt;Connecting to 192.168.55.242...&lt;BR /&gt;Password:&lt;BR /&gt;sftp&amp;gt;                      &amp;lt;---&lt;BR /&gt;sftp&amp;gt; bye"&lt;BR /&gt;&lt;BR /&gt;No...you got "sftp&amp;gt;" (see "&amp;lt;---" above)  &lt;BR /&gt;&lt;BR /&gt;something like the following *might* work:&lt;BR /&gt;&lt;BR /&gt;#!/usr/local/bin/expect&lt;BR /&gt;spawn sftp -v root@192.168.55.242&lt;BR /&gt;expect "password:"&lt;BR /&gt;send "root123\n";&lt;BR /&gt;expect "sftp&amp;gt;"&lt;BR /&gt;send "cd /var"&lt;BR /&gt;expect "sftp&amp;gt;"&lt;BR /&gt;send "put star.txt"&lt;BR /&gt;expect "sftp&amp;gt;"&lt;BR /&gt;send "bye"&lt;BR /&gt;&lt;BR /&gt;If you've an account on the remote server, consider the public key methods described above.  Or possibly contacting them to see if they can arrange to install your key for you.</description>
      <pubDate>Wed, 06 May 2009 21:37:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173625#M682218</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2009-05-06T21:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: sftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173626#M682219</link>
      <description>&lt;!--!*#--&gt;OldSchool,&lt;BR /&gt;    Its working.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Davis Paul</description>
      <pubDate>Thu, 07 May 2009 04:43:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173626#M682219</guid>
      <dc:creator>Davis Paul</dc:creator>
      <dc:date>2009-05-07T04:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: sftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173627#M682220</link>
      <description>Thanks to all ....</description>
      <pubDate>Thu, 07 May 2009 06:33:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sftp-script/m-p/5173627#M682220</guid>
      <dc:creator>Davis Paul</dc:creator>
      <dc:date>2009-05-07T06:33:51Z</dc:date>
    </item>
  </channel>
</rss>

