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

    FileZilla works, SFTP not


    I need to connect to an sftp-site with a private/public key combination. I've sent my public key to the site administrator and can connect with FileZilla without any problems. Within FileZilla I specified the location of my private key in the SFTP-settings.

    I would like to automate my FTP commands in a script, so my next step was to try sftp.

    I tried sftp with the -i option referring tot the private key file. I've also tried to copy the private key file to the .ssh-directory and chmod the key file to 600.

    But each time sftp requires a password after connecting, whereas FileZilla works out-of-the-box.

    Can you help me to solve this so I can consider scripting my downloads?

    Tx for your help

    Ivan

  2. #2
    Linux Enthusiast scathefire's Avatar
    Join Date
    Jan 2010
    Location
    Western Kentucky
    Posts
    626
    Try using -b or whatever batchfile option you have available. Consult the man pages for more info about the exact option.

    The batchfile should contain the line-by-line commands you would pass to the server (username, password, etc.) Below is an example of what might be in the batch file.

    Code:
    myusername
    mypassword
    cd some/directory
    put somefile
    quit
    linux user # 503963

  3. #3
    Tx for your reply, but I cannot login. The system keeps asking me for a password, even if I provide the private key file.

    In FileZilla it is working, but I want it to make it work in scripting.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Enthusiast scathefire's Avatar
    Join Date
    Jan 2010
    Location
    Western Kentucky
    Posts
    626
    As in login with a password or you put a password in your private key?
    linux user # 503963

  6. #5
    When generating the public and private key, I entered a passphrase. But the first time I've used FileZilla, FZ asked me the passphrase to unlock the private key so I could save the unlocked private key.

    When using FileZilla that uses this unlocked private key, I have no problem logging into the sftp-site.

    But when I want to use this unlocked private key with "sftp -i unlock_private_key.ppk user@host.com" sftp asks for a password. I've tried to chmod 600 the private key file, but this didn't help.

    Ivan

  7. #6
    SOLVED

    I had to convert the private key file-format (PPK) to an OPENSSH-format.

Posting Permissions

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