Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    how do i output sftp result to a file without scripting ?

    hi all,

    i know i am doing it wrong.
    I need to output whatever that i am doing in my sftp to a log. how do i do it ?


    I cannot see the commands i inputted, nor the file not found etc..

    what is the correct way to do it ?


  2. #2
    here what i done below :

    [tomcat@AIS_WEB 201109]$ sftp login@host > test.log
    Connecting to host...
    put abc.txt
    File "abc.txt" not found.
    [tomcat@AIS_WEB 201109]$ cat test.log
    sftp> sftp>
    [tomcat@AIS_WEB 201109]$

  3. #3
    My first instinct is to use Perl and the Net::SFTP module.

    But if you don't want the Perl learning-curve (if you don't already know it), then I'd suggest running the sftp job in screen and using screen's built-in logging facility to capture the SFTP output.

    You can call screen to run a job in detached mode - good for scripting ftp jobs.

    Read the screen man page for details.

    Or you could always set up SSH keys (to avoid having to use password prompts), and you could run your sftp jobs as scp calls, all non-interactively - easy to log the output of that.

  4. $spacer_open
  5. #4
    Linux Enthusiast scathefire's Avatar
    Join Date
    Jan 2010
    Western Kentucky
    sftp user@host | tee logfile

    linux user # 503963

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts