<?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 sftp script assistance in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/sftp-script-assistance/m-p/4932931#M46245</link>
    <description>First, I know this should be done with RSA but i need to perform some testing first. Here's what I'm hoping to accomplish:&lt;BR /&gt;&lt;BR /&gt;I'm attempting to automate a process that checks for the existence of files in a top level directory with 4 subdirectories, if it exists, it launches sftp to transfer the file to some location, it validates the send, then deletes the file. The structure would be something like this:&lt;BR /&gt;&lt;BR /&gt;/scproot/dir_out&lt;BR /&gt;/scproot/dir_out/dir1&lt;BR /&gt;/scproot/dir_out/dir2&lt;BR /&gt;/scproot/dir_out/dir3&lt;BR /&gt;/scproot/dir_out/dir4&lt;BR /&gt;&lt;BR /&gt;Each subdirectory may contain *.xml file.&lt;BR /&gt;&lt;BR /&gt;I know this is not secure but it is for testing only at this time:&lt;BR /&gt;&lt;BR /&gt;the sftp portion would be something like&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/bash&lt;BR /&gt;&lt;BR /&gt;HOST='myhost.com'&lt;BR /&gt;USER='username'&lt;BR /&gt;PASSWD='password'&lt;BR /&gt;&lt;BR /&gt;sftp -i -n $HOST &amp;lt;&lt;FILENAME&gt;&lt;/FILENAME&gt;user ${USER} ${PASSWD}&lt;BR /&gt;&lt;BR /&gt;binary&lt;BR /&gt;cd /dir1/dir2/&lt;BR /&gt;put some_file&lt;BR /&gt;&lt;BR /&gt;Can someone help me script this appropriately?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Dave</description>
    <pubDate>Tue, 11 Oct 2005 14:52:14 GMT</pubDate>
    <dc:creator>David Bell_1</dc:creator>
    <dc:date>2005-10-11T14:52:14Z</dc:date>
    <item>
      <title>sftp script assistance</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sftp-script-assistance/m-p/4932931#M46245</link>
      <description>First, I know this should be done with RSA but i need to perform some testing first. Here's what I'm hoping to accomplish:&lt;BR /&gt;&lt;BR /&gt;I'm attempting to automate a process that checks for the existence of files in a top level directory with 4 subdirectories, if it exists, it launches sftp to transfer the file to some location, it validates the send, then deletes the file. The structure would be something like this:&lt;BR /&gt;&lt;BR /&gt;/scproot/dir_out&lt;BR /&gt;/scproot/dir_out/dir1&lt;BR /&gt;/scproot/dir_out/dir2&lt;BR /&gt;/scproot/dir_out/dir3&lt;BR /&gt;/scproot/dir_out/dir4&lt;BR /&gt;&lt;BR /&gt;Each subdirectory may contain *.xml file.&lt;BR /&gt;&lt;BR /&gt;I know this is not secure but it is for testing only at this time:&lt;BR /&gt;&lt;BR /&gt;the sftp portion would be something like&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/bash&lt;BR /&gt;&lt;BR /&gt;HOST='myhost.com'&lt;BR /&gt;USER='username'&lt;BR /&gt;PASSWD='password'&lt;BR /&gt;&lt;BR /&gt;sftp -i -n $HOST &amp;lt;&lt;FILENAME&gt;&lt;/FILENAME&gt;user ${USER} ${PASSWD}&lt;BR /&gt;&lt;BR /&gt;binary&lt;BR /&gt;cd /dir1/dir2/&lt;BR /&gt;put some_file&lt;BR /&gt;&lt;BR /&gt;Can someone help me script this appropriately?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Dave</description>
      <pubDate>Tue, 11 Oct 2005 14:52:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sftp-script-assistance/m-p/4932931#M46245</guid>
      <dc:creator>David Bell_1</dc:creator>
      <dc:date>2005-10-11T14:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: sftp script assistance</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sftp-script-assistance/m-p/4932932#M46246</link>
      <description>I think that sftp may not be needed, you can use ssh an scp to do the job. You can also configure a public/private key without password to automate the process (also insecure).&lt;BR /&gt;&lt;BR /&gt;Why don't just run scp of the directories, if the file exists will be transferred, if not, won't do anything. To delete the file you can use ssh remotehost rm *.&lt;BR /&gt;&lt;BR /&gt;Something like this, is just a help, this wont work:&lt;BR /&gt;&lt;BR /&gt;FILES=`ssh remotehost find /scproot/ -type f | wc -l`&lt;BR /&gt;&lt;BR /&gt;if [ $FILES -gt 0 ]; then&lt;BR /&gt;&lt;BR /&gt;  for FILES in =`ssh remotehost find /scproot -type f`; do&lt;BR /&gt;&lt;BR /&gt;REMOTE_CHECKSUM=`ssh remotehost md5sum $FILE`&lt;BR /&gt;scp remotehost:$FILES /localdir&lt;BR /&gt;LOCAL_CHECKSUM`md5sum /localdir/$FILE`&lt;BR /&gt;&lt;BR /&gt;if [ $REMOTE_CHECKSUM = $LOCAL_CHECKSUM ];then&lt;BR /&gt;&lt;BR /&gt;ssh remotehost rm $FILE&lt;BR /&gt;&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;fi&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Oct 2005 15:08:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sftp-script-assistance/m-p/4932932#M46246</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2005-10-11T15:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: sftp script assistance</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sftp-script-assistance/m-p/4932933#M46247</link>
      <description>Ivan,&lt;BR /&gt;&lt;BR /&gt;I like what you have there with the MD5 Checksums, however, I need to simply look for the files on the "local" server, then if they exist, sftp them to a "remote" server. I do need to use sftp in this instance (not my choice). I would still like to use the incorporation of the MD5 that you listed but I'm not sure how to do that with sftp. &lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Dave&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Oct 2005 15:23:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sftp-script-assistance/m-p/4932933#M46247</guid>
      <dc:creator>David Bell_1</dc:creator>
      <dc:date>2005-10-11T15:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: sftp script assistance</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sftp-script-assistance/m-p/4932934#M46248</link>
      <description>I understand, i though that was from the remote server to the local server.&lt;BR /&gt;&lt;BR /&gt;You won't be able to do checksum comparations using sftp, but you can do an ls -l after the transfer. All sftp transaction output should be redirect to a file. Then using awk or grep, get the file size and compare it with the local file.&lt;BR /&gt;&lt;BR /&gt;I still think that sshd and scp will do a better job. I know that is not about you, but you should explain that will be more reliable this way.</description>
      <pubDate>Tue, 11 Oct 2005 15:40:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sftp-script-assistance/m-p/4932934#M46248</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2005-10-11T15:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: sftp script assistance</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sftp-script-assistance/m-p/4932935#M46249</link>
      <description>Ivan,&lt;BR /&gt;&lt;BR /&gt;Thanks for the assistance. I'll keep trying to get the information put together for the script.&lt;BR /&gt;&lt;BR /&gt;Dave</description>
      <pubDate>Tue, 11 Oct 2005 15:52:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sftp-script-assistance/m-p/4932935#M46249</guid>
      <dc:creator>David Bell_1</dc:creator>
      <dc:date>2005-10-11T15:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: sftp script assistance</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sftp-script-assistance/m-p/4932936#M46250</link>
      <description>I'm going to continue to search other locations for response. Dave</description>
      <pubDate>Tue, 11 Oct 2005 16:15:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sftp-script-assistance/m-p/4932936#M46250</guid>
      <dc:creator>David Bell_1</dc:creator>
      <dc:date>2005-10-11T16:15:40Z</dc:date>
    </item>
  </channel>
</rss>

