<?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: Using scp in a script without inputing passwords in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/using-scp-in-a-script-without-inputing-passwords/m-p/2631615#M921353</link>
    <description>Jeff,&lt;BR /&gt;&lt;BR /&gt;  I had ran into the same problem few months back and the solution i came up with was , using the following wrapper script:&lt;BR /&gt;&lt;BR /&gt;The key thing to note in the below script is the way i am calling the ssh-agent2 in the shell line itself!&lt;BR /&gt;****&lt;BR /&gt;#!/usr/local/bin/ssh-agent2 /bin/ksh&lt;BR /&gt;echo $1 &amp;gt;/tmp/scp_wrapper.log 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;/usr/local/bin/ssh-add2 /home/userid/.ssh2/id_dsa_1024_a&lt;BR /&gt;/usr/local/bin/scp $* &amp;gt; /home/userid/scp.log 2&amp;gt;&amp;amp;1&lt;BR /&gt;***&lt;BR /&gt;&lt;BR /&gt;  And then calling this wrapper script through a master script using the command:&lt;BR /&gt;&lt;BR /&gt;su -  userid -c "$SOURCE_DIR/scp_wrapper.ksh $SOURCE_DIR/$TARFILE userid@$REMOTE_HOST:$REMOTE_DIR"&lt;BR /&gt;&lt;BR /&gt;(Here i am copying a tar file across to another system)&lt;BR /&gt;&lt;BR /&gt;Ofcourse, all this is assuming you have already setup the keys and running the sshd daemons on both the boxes.&lt;BR /&gt;&lt;BR /&gt;HTh&lt;BR /&gt;raj&lt;BR /&gt;</description>
    <pubDate>Fri, 14 Dec 2001 18:14:00 GMT</pubDate>
    <dc:creator>Roger Baptiste</dc:creator>
    <dc:date>2001-12-14T18:14:00Z</dc:date>
    <item>
      <title>Using scp in a script without inputing passwords</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-scp-in-a-script-without-inputing-passwords/m-p/2631611#M921349</link>
      <description>Hello,&lt;BR /&gt;I am trying to use scp (secure copy) to move files from one server to another.  However, I don't want to have to input a password each time because I want to run scp in a script.  I followed these steps so I don't have to input a password each time:&lt;BR /&gt;1. ssh-agent /bin/sh (substitute the name of your favorite command shell) &lt;BR /&gt;2. ssh-add, and then type your SSH passphrase &lt;BR /&gt;3. ssh machine-name&lt;BR /&gt;&lt;BR /&gt;...but this only lasts until I end the session.  Is there a way to set this up, so a script can run daily without the need of a password?  Thanks, Jeff</description>
      <pubDate>Fri, 14 Dec 2001 17:27:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-scp-in-a-script-without-inputing-passwords/m-p/2631611#M921349</guid>
      <dc:creator>Jeff Daigle</dc:creator>
      <dc:date>2001-12-14T17:27:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using scp in a script without inputing passwords</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-scp-in-a-script-without-inputing-passwords/m-p/2631612#M921350</link>
      <description>you are probably going to have to download the expect program, in there is a program called autopasswd that you can modify to fit ssh-add instead of passwd</description>
      <pubDate>Fri, 14 Dec 2001 17:32:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-scp-in-a-script-without-inputing-passwords/m-p/2631612#M921350</guid>
      <dc:creator>Jeff Machols</dc:creator>
      <dc:date>2001-12-14T17:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: Using scp in a script without inputing passwords</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-scp-in-a-script-without-inputing-passwords/m-p/2631613#M921351</link>
      <description>Is there any way to have the script read in the password or to store it somewhere, so ssh does not need it entered each time?&lt;BR /&gt;&lt;BR /&gt;Thanks for any help,&lt;BR /&gt;Jeff</description>
      <pubDate>Fri, 14 Dec 2001 18:03:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-scp-in-a-script-without-inputing-passwords/m-p/2631613#M921351</guid>
      <dc:creator>Jeff Daigle</dc:creator>
      <dc:date>2001-12-14T18:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: Using scp in a script without inputing passwords</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-scp-in-a-script-without-inputing-passwords/m-p/2631614#M921352</link>
      <description>if you get expect, you can have the script send the password so it can be automated</description>
      <pubDate>Fri, 14 Dec 2001 18:06:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-scp-in-a-script-without-inputing-passwords/m-p/2631614#M921352</guid>
      <dc:creator>Jeff Machols</dc:creator>
      <dc:date>2001-12-14T18:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: Using scp in a script without inputing passwords</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-scp-in-a-script-without-inputing-passwords/m-p/2631615#M921353</link>
      <description>Jeff,&lt;BR /&gt;&lt;BR /&gt;  I had ran into the same problem few months back and the solution i came up with was , using the following wrapper script:&lt;BR /&gt;&lt;BR /&gt;The key thing to note in the below script is the way i am calling the ssh-agent2 in the shell line itself!&lt;BR /&gt;****&lt;BR /&gt;#!/usr/local/bin/ssh-agent2 /bin/ksh&lt;BR /&gt;echo $1 &amp;gt;/tmp/scp_wrapper.log 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;/usr/local/bin/ssh-add2 /home/userid/.ssh2/id_dsa_1024_a&lt;BR /&gt;/usr/local/bin/scp $* &amp;gt; /home/userid/scp.log 2&amp;gt;&amp;amp;1&lt;BR /&gt;***&lt;BR /&gt;&lt;BR /&gt;  And then calling this wrapper script through a master script using the command:&lt;BR /&gt;&lt;BR /&gt;su -  userid -c "$SOURCE_DIR/scp_wrapper.ksh $SOURCE_DIR/$TARFILE userid@$REMOTE_HOST:$REMOTE_DIR"&lt;BR /&gt;&lt;BR /&gt;(Here i am copying a tar file across to another system)&lt;BR /&gt;&lt;BR /&gt;Ofcourse, all this is assuming you have already setup the keys and running the sshd daemons on both the boxes.&lt;BR /&gt;&lt;BR /&gt;HTh&lt;BR /&gt;raj&lt;BR /&gt;</description>
      <pubDate>Fri, 14 Dec 2001 18:14:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-scp-in-a-script-without-inputing-passwords/m-p/2631615#M921353</guid>
      <dc:creator>Roger Baptiste</dc:creator>
      <dc:date>2001-12-14T18:14:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using scp in a script without inputing passwords</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-scp-in-a-script-without-inputing-passwords/m-p/2631616#M921354</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;To run scp without a password, you should make use of trusting of public keys.&lt;BR /&gt;&lt;BR /&gt;I have been using scp in my cron job to propagate configuration files to a backup server at periodic intervals.&lt;BR /&gt;&lt;BR /&gt;Below configuration pertains to what I have implemented for my environment based on SSH2 protocol, using opensource SSH Communication implementation. The last version I know is ssh-3.0.1 for this implementation.&lt;BR /&gt;&lt;BR /&gt;On your CLIENT:&lt;BR /&gt;==============&lt;BR /&gt;&lt;BR /&gt;1) Login to your user account, then run ssh-keygen to generate the public key on the client user@machine you are scp'ing from. &lt;BR /&gt;&lt;BR /&gt;user&amp;gt; ssh-keygen&lt;BR /&gt;&lt;BR /&gt;ssh-keygen will create a .ssh2 directory and store your public key into a file (default filename  id_dsa_1024_a.pub) and your private key into a file (default filename id_dsa_1024_a).&lt;BR /&gt;&lt;BR /&gt;2) In your identification file, insert the Identification Key reference.&lt;BR /&gt;&lt;BR /&gt;client_user&amp;gt; cd $HOME/.ssh2&lt;BR /&gt;client_user&amp;gt; vi identification&lt;BR /&gt;&lt;BR /&gt;IdKey id_dsa_1024_a&lt;BR /&gt;&lt;BR /&gt;3) Copy your public key (id_dsa_1024_a.pub) to the server (into the .ssh2 directory) which you are scp'ing to.&lt;BR /&gt;&lt;BR /&gt;On your SERVER:&lt;BR /&gt;==============&lt;BR /&gt;&lt;BR /&gt;1) Create the .ssh2 directory. Alternatively, also run ssh-keygen if you want to use this server_user account to scp to another server2_user account.&lt;BR /&gt;&lt;BR /&gt;server_user&amp;gt; cd $HOME&lt;BR /&gt;server_user&amp;gt; mkdir .ssh2&lt;BR /&gt;server_user&amp;gt; chmod 700 .ssh2&lt;BR /&gt;&lt;BR /&gt;2) In the authorization file, insert your public key reference.&lt;BR /&gt;&lt;BR /&gt;server_user&amp;gt; cd .ssh2&lt;BR /&gt;server_user&amp;gt; vi authorization&lt;BR /&gt;&lt;BR /&gt;Key id_dsa_1024_a.pub&lt;BR /&gt;&lt;BR /&gt;Initialization:&lt;BR /&gt;==============&lt;BR /&gt;&lt;BR /&gt;1) During your first scp, it may prompt you whether you would like to save the host key because if it is the first time you are scp'ing from this client to that server.&lt;BR /&gt;&lt;BR /&gt;2) Note that your /etc/ssh2/sshd2_config on your server must allow for publickey authentication method.&lt;BR /&gt;&lt;BR /&gt;3) Subsequently your scp should work based on automatic public key authentication, rather than interactive password mode.&lt;BR /&gt;&lt;BR /&gt;Hope this helps. Regards.&lt;BR /&gt;&lt;BR /&gt;Steven Sim Kok Leong&lt;BR /&gt;Brainbench MVP for Unix Admin&lt;BR /&gt;&lt;A href="http://www.brainbench.com" target="_blank"&gt;http://www.brainbench.com&lt;/A&gt;</description>
      <pubDate>Tue, 18 Dec 2001 00:39:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-scp-in-a-script-without-inputing-passwords/m-p/2631616#M921354</guid>
      <dc:creator>Steven Sim Kok Leong</dc:creator>
      <dc:date>2001-12-18T00:39:36Z</dc:date>
    </item>
  </channel>
</rss>

