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