I am trying to create a script to upload some files to a server via SFTP. I can do that manually by opening an interactive lftp-session and providing username and password there. For the script, I would like to
- not hardcode credentials in the script (for obvious reasons)
- not mention them on the commandline (I want the command in my .bash_history, but of course not the credentials)
- have
lftp
read the credentials from .netrc
or something similar
I cannot seem to get this working. My current workaround is a wrapper-script that parses the .netrc
for the credentials and adds them to a lftp-script which I delete afterwards. This simulates the steps I perform manually, but seems like re-implementing existing functionality poorly. While this works, the question remains:
> Can lftp read .netrc for SFTP-connections?
If so, are there special syntax-requirements if customs ports are part of the setup? I need to connect to sftp://username:password1@example.com:12322
.
Asked by kronn
(399 rep)
Apr 30, 2016, 03:42 PM
Last activity: Dec 11, 2021, 07:44 AM
Last activity: Dec 11, 2021, 07:44 AM