Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
I need to do a script to upload file by lftp to a remote sftp server by the use of private\public key without password; I generated the keys from a normal user and if I use the script from the normal user it works but I should crontab the script from root who by default can't read the key of the user so I should add a line to "redirect it"!
Here below there's the script which, like what I said above, works from the normal user environment:
reinob wrote: ↑2023-01-24 15:45
why use lftp for sftp?
Because the remote sftp server is on Windows o.s. and it doesn't work obviously with all linux commands... :\
reinob wrote: ↑2023-01-24 15:45
you could use rsync over ssh, and with it you can pass any key (identity),
something like:
Linux to Linux I could use also scp but, like what I wrote above, I don't know if rsync could work on Microsoft O.S.
reinob wrote: ↑2023-01-24 15:45
(note that in the example above you use a password, so I'm confused as to what exactly you want to have)
I wrote the word "password" because lftp wants it when you have passwordless, if you doesn't add it the remote system requires to insert it also if the remote public it doesn't have it!
reinob wrote: ↑2023-01-24 17:29
OK, I guess I assumed linux-to-linux
In a wonderful world everyone should use Linux distros!
reinob wrote: ↑2023-01-24 17:29
But at least lftp appears to support giving it a "connect program", with the option sftp:server-program, so you could try adding:
sftp:connect-program "sftp -i /path/to/identity"
HOST='sftp://remote_ip:remote_port'
USER='ftp_username'
PASS='password'
TARGETFOLDER='/remote_folder'
SOURCEFOLDER='/home/user/upload'
lftp -c "
set ftp:ssl-allow no
open $HOST
user $USER $PASS
mirror -R --verbose $SOURCEFOLDER $TARGETFOLDER
bye
"
I think I don't need to insert the username like what you wrote above so I can get it from the variable maybe I should use a variable also for sftp:connect-program "sftp -i /path/to/identity" and insert it before open command...
reinob wrote: ↑2023-01-24 17:29
Whether this still requires a (dummy) password or not.. it seems you have a weird SFTP server on the Windows side..