<?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: sample script for scp and sftp in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/sample-script-for-scp-and-sftp/m-p/4243295#M330282</link>
    <description>Hi Kathy,&lt;BR /&gt;&lt;BR /&gt;for using scp, you must copy your public keys in authorized_keys file in host target&lt;BR /&gt;and write a command in your script with scp command:&lt;BR /&gt;you can use a man page of scp command  for more detail.&lt;BR /&gt;&lt;BR /&gt;Regards.&lt;BR /&gt;&lt;BR /&gt;Philippe</description>
    <pubDate>Thu, 31 Jul 2008 05:25:54 GMT</pubDate>
    <dc:creator>Ph. LAQUERRIERE</dc:creator>
    <dc:date>2008-07-31T05:25:54Z</dc:date>
    <item>
      <title>sample script for scp and sftp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sample-script-for-scp-and-sftp/m-p/4243294#M330281</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;I have a couple of questions reguarding scp and sftp. &lt;BR /&gt;&lt;BR /&gt;1. I was told by out network/security admin that scp is prefered over sftp when it comes to security issues, and to use scp forcing it to use protocol 2. Do you all agree? if so anyone has a sample script using scp with protocal 2 please share.&lt;BR /&gt;&lt;BR /&gt;2. I need to convert all my scripts that run ftp and are like the following example:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;ftpfile=/home/kathyk/test.ftp&lt;BR /&gt;echo user kathyk sheila22 &amp;gt;  $ftpfile&lt;BR /&gt;echo cd /home/kathyk                      &amp;gt;&amp;gt; $ftpfile&lt;BR /&gt;echo lcd /home/kathyk                        &amp;gt;&amp;gt; $ftpfile&lt;BR /&gt;echo put newjunk                   &amp;gt;&amp;gt; $ftpfile&lt;BR /&gt;echo put nofile                 &amp;gt;&amp;gt; $ftpfile&lt;BR /&gt;#echo put newjunk                   &amp;gt;&amp;gt; $ftpfile&lt;BR /&gt;echo bye      &amp;gt;&amp;gt; $ftpfile&lt;BR /&gt;#echo ENDFTP      &amp;gt;&amp;gt; $ftpfile&lt;BR /&gt;ftp -i -n -v mongo1 &amp;lt; $ftpfile  &amp;gt; /home/kathyk/ftp.log 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;To invoke scp or sftp. again if anyone has a sample script please share. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Your assistance is greatley appreciated.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Kathy&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 30 Jul 2008 21:58:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sample-script-for-scp-and-sftp/m-p/4243294#M330281</guid>
      <dc:creator>Kathy Khaghani</dc:creator>
      <dc:date>2008-07-30T21:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: sample script for scp and sftp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sample-script-for-scp-and-sftp/m-p/4243295#M330282</link>
      <description>Hi Kathy,&lt;BR /&gt;&lt;BR /&gt;for using scp, you must copy your public keys in authorized_keys file in host target&lt;BR /&gt;and write a command in your script with scp command:&lt;BR /&gt;you can use a man page of scp command  for more detail.&lt;BR /&gt;&lt;BR /&gt;Regards.&lt;BR /&gt;&lt;BR /&gt;Philippe</description>
      <pubDate>Thu, 31 Jul 2008 05:25:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sample-script-for-scp-and-sftp/m-p/4243295#M330282</guid>
      <dc:creator>Ph. LAQUERRIERE</dc:creator>
      <dc:date>2008-07-31T05:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: sample script for scp and sftp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sample-script-for-scp-and-sftp/m-p/4243296#M330283</link>
      <description>1.) Because both scp and sftp use the same SSH protocol for encryption, the preference for sftp might not be security-related, but something related to the local setup.&lt;BR /&gt;&lt;BR /&gt;Forcing a HP-supplied scp to use protocol version 2 is very simple: just use option "-2" with the scp command.&lt;BR /&gt;&lt;BR /&gt;2.)&lt;BR /&gt;With scp, your script can be reduced to a single command:&lt;BR /&gt;&lt;BR /&gt;scp -2 /home/kathyk/newjunk /home/kathyk/nofile kathyk@mongo1:/home/kathyk&lt;BR /&gt;&lt;BR /&gt;If you're logged in as "kathyk" on the local host, /home/kathyk is your home directory on the host mongo1 and you're currently cd'd to directory /home/kathyk on the local host, you can even simplify it further to:&lt;BR /&gt;&lt;BR /&gt;scp -2 newjunk nofile mongo1:&lt;BR /&gt;&lt;BR /&gt;If you don't have SSH keys set up, these commands will ask for a password. &lt;BR /&gt;&lt;BR /&gt;----------&lt;BR /&gt;&lt;BR /&gt;The usual way to set up SSH keys for one user for unattended/scripted file transfers:&lt;BR /&gt;&lt;BR /&gt;ssh-keygen -t rsa&lt;BR /&gt;(accept all the defaults, leave the key passphrase as blank for unattended/scripted operations)&lt;BR /&gt;ssh kathyk@mongo1&lt;BR /&gt;(password required for authentication)&lt;BR /&gt;(the next commands on mongo1)&lt;BR /&gt;mkdir .ssh&lt;BR /&gt;chmod 700 .ssh&lt;BR /&gt;chmod go-w $HOME&lt;BR /&gt;exit&lt;BR /&gt;(back on the local host)&lt;BR /&gt;scp $HOME/.ssh/id_rsa.pub kathyk@mongo1:.ssh/authorized_keys&lt;BR /&gt;(this is the last time you'll need a password  for this connection)&lt;BR /&gt;&lt;BR /&gt;At this point, you should be able to use ssh/scp/sftp to connect from your current user at the local host to kathyk@mongo1 without any password prompts, unless the admin of mongo1 has disabled the SSH key authentication at the server end.&lt;BR /&gt;&lt;BR /&gt;MK</description>
      <pubDate>Thu, 31 Jul 2008 07:52:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sample-script-for-scp-and-sftp/m-p/4243296#M330283</guid>
      <dc:creator>Matti_Kurkela</dc:creator>
      <dc:date>2008-07-31T07:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: sample script for scp and sftp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sample-script-for-scp-and-sftp/m-p/4243297#M330284</link>
      <description>Thank you Matti for the comprehensive answer. To be clear would this part Be on the remote server? (ftp server).&lt;BR /&gt;&lt;BR /&gt;ssh-keygen -t rsa&lt;BR /&gt;(accept all the defaults, leave the key passphrase as blank for unattended/scripted operations)&lt;BR /&gt;ssh kathyk@mongo1&lt;BR /&gt;(password required for authentication)&lt;BR /&gt;(the next commands on mongo1)&lt;BR /&gt;mkdir .ssh&lt;BR /&gt;chmod 700 .ssh&lt;BR /&gt;chmod go-w $HOME&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks again&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Kathy&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 31 Jul 2008 15:28:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sample-script-for-scp-and-sftp/m-p/4243297#M330284</guid>
      <dc:creator>Kathy Khaghani</dc:creator>
      <dc:date>2008-07-31T15:28:37Z</dc:date>
    </item>
  </channel>
</rss>

