diff --git a/src/commands.cc.old b/src/commands.cc
index c181c9f..88e90a4 100644
--- a/src/commands.cc.old
+++ b/src/commands.cc
@@ -821,13 +821,15 @@ Job *CmdExec::builtin_open()
enum {
OPT_USER,
- OPT_PASSWORD
+ OPT_PASSWORD,
+ OPT_ENV_PASSWORD
};
static struct option open_options[]=
{
{"port",required_argument,0,'p'},
{"user",required_argument,0,OPT_USER},
{"password",required_argument,0,OPT_PASSWORD},
+ {"env-password",no_argument,0,OPT_ENV_PASSWORD},
{"execute",required_argument,0,'e'},
{"debug",optional_argument,0,'d'},
{"no-bookmark",no_argument,0,'B'},
@@ -867,6 +869,9 @@ Job *CmdExec::builtin_open()
case(OPT_PASSWORD):
pass=optarg;
break;
+ case(OPT_ENV_PASSWORD):
+ pass=getenv("LFTP_PASSWORD");
+ break;
case('d'):
debug=true;
break;
diff --git a/doc/lftp.1.old b/doc/lftp.1
index 5e55ae9..bba558d 100644
--- a/doc/lftp.1.old
+++ b/doc/lftp.1
@@ -657,6 +657,7 @@ List remote file names
.B open
.RB [ \-e " \fIcmd\fP]"
.BR "[" \-u " \fIuser\fP[", "\fIpass\fP]]"
+.BR "[" \-\-env\-password]
.BR "[" \-p " \fIport\fP] \fIhost\fP|\fIurl\fP"
.PP
Select a FTP server.
@@ -2014,7 +2015,8 @@ Use the given port to connect.
.TP
.BI \-u " user\fR[\fP\fB,\fPpass\fR]\fP"
Use the given username and password to connect. Remember to quote the password properly in the shell.
-Also note that it is not secure to specify the password on command line, use \fI~/.netrc\fP file.
+Also note that it is not secure to specify the password on command line, use \fI~/.netrc\fP file or
+\fBLFTP_PASSWORD\fP environment variable together with \-\-env\-password option.
Alternatively you can use ssh-based protocols with authorized keys, so you don't have to enter a password.
.PP
.TP
@@ -2048,6 +2050,8 @@ Used to set initial module:path variable.
.IP "\fBLFTP_HOME\fP"
Used to locate the directory that stores user-specific configuration files. If
unset, \fI~/.lftp\fR will be used.
+.IP "\fBLFTP_PASSWORD\fP"
+Used for \-\-env\-password \fBopen\fP option.
.IP "\fBLS_COLORS\fP"
used to set initial color:dir-colors variable.
.IP "\fBXDG_CONFIG_DIR\fP, \fBXDG_DATA_DIR\fP, \fBXDG_CACHE_DIR\fP"