Find the answer to your Linux question:
Results 1 to 5 of 5
hey all, I am trying to automate an SFTP jop using bash scripting. thing is i can't figure out how to set up sftp to allow me to log in ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2006
    Posts
    39

    automated SFTP in FD5


    hey all,

    I am trying to automate an SFTP jop using bash scripting. thing is i can't figure out how to set up sftp to allow me to log in without a password. i need to log in with a password but there is no sftp option that would allow me to do this. i must enter the password manually. how do i set up such a system? this is what i want to do :

    sftp user@machine
    password
    cd mydir
    get myfile
    quit

    i need to negate the password part of figure out how to put it in the first line i read that i can use the -b option but i am not at all clear as to how this would work. any suggestions would be greatfull....i am new to linux o please be easy on me.


    thanks


    -B

  2. #2
    Linux User
    Join Date
    Jun 2006
    Posts
    311
    Hi ikiini,
    You can automate ftp process by using the sophisticated file transfer program, lftp. By using the -u option with open command you can enter the username and the password also in the script to run without getting prompted for password. But remember that you are going to store this password in a file. So your script would look like this : -

    open -u username,password FTP_Site
    cd mydir
    get myfile
    bye
    Save the above commands into a file, say ftp_script. To run the script just run the command : -

    $ lftp -f ftp_script
    With Regards,
    Thinker

  3. #3
    Linux Guru anomie's Avatar
    Join Date
    Mar 2005
    Location
    Texas
    Posts
    1,692
    If you're not running a ftp server on the other end (and want to stick with ssh/sftp) you have a couple options:

    1. You can use scp coupled with pubkey authentication.

    2. You can use sftp with the -b option, again coupled with pubkey authentication.

    Here is a pubkey authentication howto if you're interested: http://wiki.suselinuxsupport.de/wikk...Authentication

    It's written for suse, but is sufficiently generic (with the exception of step 7: restarting the sshd service).

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    May 2006
    Posts
    39
    thank you for the input...i am goign to try both approaches on friday when i get into work. However, My boss wants me to do the automation with Kettle's chef tool. if you guys are familar with this tool any suggestions on how to do this would be great. Thanks

    -B

  6. #5
    Just Joined!
    Join Date
    Dec 2006
    Posts
    13

    Thumbs up Thanks

    Hey, thanks man. I've been working on a script for several weeks to automate syncing between my machine and an ftp server, and your reply(thinker) demystified a huge problem I was having =D

Posting Permissions

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