diff --git a/backend/ftp/ftp.go b/backend/ftp/ftp.go
index 0c4ba87ea..73148da55 100644
--- a/backend/ftp/ftp.go
+++ b/backend/ftp/ftp.go
@@ -6,7 +6,6 @@ import (
 	"crypto/tls"
 	"io"
 	"net/textproto"
-	"os"
 	"path"
 	"runtime"
 	"strings"
@@ -22,10 +21,15 @@ import (
 	"github.com/rclone/rclone/fs/config/obscure"
 	"github.com/rclone/rclone/fs/hash"
 	"github.com/rclone/rclone/lib/encoder"
+	"github.com/rclone/rclone/lib/env"
 	"github.com/rclone/rclone/lib/pacer"
 	"github.com/rclone/rclone/lib/readers"
 )
 
+var (
+	currentUser = env.CurrentUser()
+)
+
 // Register with Fs
 func init() {
 	fs.Register(&fs.RegInfo{
@@ -42,7 +46,7 @@ func init() {
 			}},
 		}, {
 			Name: "user",
-			Help: "FTP username, leave blank for current username, " + os.Getenv("USER"),
+			Help: "FTP username, leave blank for current username, " + currentUser,
 		}, {
 			Name: "port",
 			Help: "FTP port, leave blank to use default (21)",
@@ -311,7 +315,7 @@ func NewFs(name, root string, m configmap.Mapper) (ff fs.Fs, err error) {
 	}
 	user := opt.User
 	if user == "" {
-		user = os.Getenv("USER")
+		user = currentUser
 	}
 	port := opt.Port
 	if port == "" {
diff --git a/backend/sftp/sftp.go b/backend/sftp/sftp.go
index 0cda21c2f..093ca0276 100644
--- a/backend/sftp/sftp.go
+++ b/backend/sftp/sftp.go
@@ -11,7 +11,6 @@ import (
 	"io"
 	"io/ioutil"
 	"os"
-	"os/user"
 	"path"
 	"regexp"
 	"strconv"
@@ -43,7 +42,7 @@ const (
 )
 
 var (
-	currentUser = readCurrentUser()
+	currentUser = env.CurrentUser()
 )
 
 func init() {
@@ -237,20 +236,6 @@ type Object struct {
 	sha1sum *string     // Cached SHA1 checksum
 }
 
-// readCurrentUser finds the current user name or "" if not found
-func readCurrentUser() (userName string) {
-	usr, err := user.Current()
-	if err == nil {
-		return usr.Username
-	}
-	// Fall back to reading $USER then $LOGNAME
-	userName = os.Getenv("USER")
-	if userName != "" {
-		return userName
-	}
-	return os.Getenv("LOGNAME")
-}
-
 // dial starts a client connection to the given SSH server. It is a
 // convenience function that connects to the given network address,
 // initiates the SSH handshake, and then sets up a Client.
diff --git a/docs/content/ftp.md b/docs/content/ftp.md
index baf2d69e0..c228f6299 100644
--- a/docs/content/ftp.md
+++ b/docs/content/ftp.md
@@ -48,7 +48,7 @@ Choose a number from below, or type in your own value
  1 / Connect to ftp.example.com
    \ "ftp.example.com"
 host> ftp.example.com
-FTP username, leave blank for current username, ncw
+FTP username, leave blank for current username, $USER
 Enter a string value. Press Enter for the default ("").
 user> 
 FTP port, leave blank to use default (21)
diff --git a/docs/content/sftp.md b/docs/content/sftp.md
index a354c29e2..c0c8cc1eb 100644
--- a/docs/content/sftp.md
+++ b/docs/content/sftp.md
@@ -52,7 +52,7 @@ Choose a number from below, or type in your own value
  1 / Connect to example.com
    \ "example.com"
 host> example.com
-SSH username, leave blank for current username, ncw
+SSH username, leave blank for current username, $USER
 user> sftpuser
 SSH port, leave blank to use default (22)
 port>
@@ -192,7 +192,7 @@ SSH host to connect to
 
 #### --sftp-user
 
-SSH username, leave blank for current username, ncw
+SSH username, leave blank for current username, $USER
 
 - Config:      user
 - Env Var:     RCLONE_SFTP_USER
@@ -256,7 +256,9 @@ in the new OpenSSH format can't be used.
 
 #### --sftp-pubkey-file
 
-Optional path to public key file; set this if you have a signed certificate you want to use for authentication.
+Optional path to public key file.
+
+Set this if you have a signed certificate you want to use for authentication.
 
 Leading `~` will be expanded in the file name as will environment variables such as `${RCLONE_CONFIG_DIR}`.
 
diff --git a/lib/env/env.go b/lib/env/env.go
index 739b4a2d7..8e503aeed 100644
--- a/lib/env/env.go
+++ b/lib/env/env.go
@@ -3,6 +3,7 @@ package env
 
 import (
 	"os"
+	"os/user"
 
 	homedir "github.com/mitchellh/go-homedir"
 )
@@ -24,3 +25,22 @@ func ShellExpand(s string) string {
 	}
 	return s
 }
+
+// CurrentUser finds the current user name or "" if not found
+func CurrentUser() (userName string) {
+	userName = os.Getenv("USER")
+	// If we are making docs just use $USER
+	if userName == "$USER" {
+		return userName
+	}
+	// Try reading using the OS
+	usr, err := user.Current()
+	if err == nil {
+		return usr.Username
+	}
+	// Fall back to reading $USER then $LOGNAME
+	if userName != "" {
+		return userName
+	}
+	return os.Getenv("LOGNAME")
+}