LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-25-2014, 05:30 AM   #1
aarelovich
LQ Newbie
 
Registered: Mar 2014
Posts: 3

Rep: Reputation: Disabled
Passwordless connection to sftp server using lftp


Hello. This is my first time writing to this forum and I thought this was the best place for this question. I apologize if it is not (I've read the guidelines).

I'm running the following script that uses lftp:

lftp -f "
open sftp://myuser@sftp_server:443
lcd $FTP_FOLDER
mirror --no-empty-dirs --only-newer --verbose $FTP_FOLDER $LOCAL_FOLDER
bye
"
Now If I've allready passed my public key to the server administrator so if do this in the command line

sftp -P 443 myuser@sftp_server

I get connected and I get the sftp prompt. When I do this the pwd command tells me that the folder that I need to sync has the path "/0Datos" and that is the value of $FTP_FOLDER.

When I execute the script I get this:

source: Is a directory
Password:

Is there any way to connect without the server asking me for a password (I don't have it) in order to sync the folder 0Datos to a local folder of mine?

Thank you for your time.
 
Old 03-25-2014, 07:43 AM   #2
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 665

Rep: Reputation: Disabled
Quote:
Is there any way to connect without the server asking me for a password (I don't have it) in order to sync the folder 0Datos to a local folder of mine?
if you don't have the password!! NO
if admin have setup the authentication mechanism to prompt for the password the configuration would anyways look for it and reject your login unless you are privilaged for passwordless login by your admin.
however if you are an authorised user try this

Last edited by SAbhi; 03-25-2014 at 07:47 AM.
 
Old 03-25-2014, 08:10 AM   #3
aarelovich
LQ Newbie
 
Registered: Mar 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks for the reply. But I don't get it. The admin set it up so that I can login with my public key. Why is it different when using lftp?
 
Old 03-25-2014, 08:14 AM   #4
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
You have to use a meaningless placeholder text:

Code:
lftp -u username,placeholder sftp://1.2.3.4
Additional info: http://matthewbotos.com/blog/2007/08...-keys-and-lftp
 
1 members found this post helpful.
Old 03-25-2014, 08:40 AM   #5
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,326

Rep: Reputation: 919Reputation: 919Reputation: 919Reputation: 919Reputation: 919Reputation: 919Reputation: 919Reputation: 919
seems like scp or sshfs would be easier in this context ?
 
Old 03-25-2014, 09:16 AM   #6
aarelovich
LQ Newbie
 
Registered: Mar 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thank you so very much!!! That did the trick. For completion I'm posting my script for remote sychronization under this scenario.

Code:
lftp -f "
open -p port -u user,any_string_will_do sftp://server
mirror --no-empty-dirs  --only-newer --verbose $FTP_FOLDER $LOCAL_FOLDER
bye
"
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
passwordless keybased sftp vikash.thbs Linux - Newbie 1 04-30-2013 06:33 AM
Error dowloading with lftp from sftp server: get: Access failed: No such file dgerber Linux - Newbie 0 02-10-2013 04:47 AM
Passwordless sftp in shell script pavan06 Linux - Newbie 5 09-06-2011 08:06 PM
Passwordless SFTP between Unix box and Windows dev_d Linux - Networking 3 03-31-2010 07:08 AM
Passwordless sftp to many remote hosts ahmad_abdulghany Linux - Networking 7 04-04-2007 06:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration