LFTP:保存特定服务器的用户名/密码?(LFTP: save username/password for specific server?)

编程入门 行业动态 更新时间:2024-10-25 00:34:13
LFTP:保存特定服务器的用户名/密码?(LFTP: save username/password for specific server?)

我可以在某个本地配置文件中为ftp服务器保存用户名/密码对,以便lftp在连接到该服务器时会自动找到它们吗?

背景:我有一些脚本,将由多个用户使用,具有不同的用户名/密码对,以将一些生成的内容从存储库同步到ftp服务器。 不必每次都手动输入我们的用户名/密码。 由于ftp密码是以明文形式发送的,因此我们都使用低值密码,因此将密码以明文形式存储在本地配置文件中是可以接受的。

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.

最满意答案

您可以使用〜/ .netrc文件或lftp书签。

〜/ .netrc中添加这样的东西:

machine your.server.example.com login your_login password your_password

然后lftp会在打开ftp://your_login@your.server.example.com时选择密码,并且在没有URL语法的情况下打开“your.server.example.com”时会自动使用your_login

使用书签时,请执行“set bmk:save-passwords true” (默认为false),然后将当前会话保存到名称下的书签中, “open bookmark_name”将使用登录/密码对。 书签文件是纯文本,因此您甚至可以通过任何文本编辑器添加带有登录名/密码的URL。 要为所有用户使用通用书签,请将LFTP_HOME环境变量设置为公共目录。

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://your_login@your.server.example.com, 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.

更多推荐

本文发布于:2023-07-09 02:20:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1082874.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:用户名   密码   服务器   LFTP   save

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!