Can I save a username/password pair for an ftp server in some local configuration file, so that lftp
will find them automatically when connecting to that server?
Background: I have script which will be used by multiple users, with different username/password pairs, to sync some generated content from a repository to an ftp server. It would be nice not to have to enter our usernames/passwords by hand each time. Since ftp passwords are sent in cleartext, we are all using low-value passwords for this, so storing the passwords in cleartext in a local config file is acceptable.
You can use ~/.netrc file or lftp bookmarks.
Add something like this to ~/.netrc:
machine your.server.example.com login your_login password your_password
Then lftp will pick the password when opening ftp://[email protected], and it will use your_login automatically when opening "your.server.example.com" without the URL syntax.
When using bookmarks, do "set bmk:save-passwords true" (default is false), then save the current session to bookmarks under a name, then "open bookmark_name" will use the login/password pair. The bookmarks file is plain text, so you can even add the URL with login/password by any text editor. To use a common bookmarks for all users set LFTP_HOME environment variable to a common directory.