From 052c886317d14228dbcdf257d10bf02cffc90bbc Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Mon, 8 Jan 2018 21:39:16 +0000 Subject: [PATCH] sftp: read $USER in username fallback not $HOME --- sftp/sftp.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sftp/sftp.go b/sftp/sftp.go index 8b0b58646..7d287c880 100644 --- a/sftp/sftp.go +++ b/sftp/sftp.go @@ -123,8 +123,8 @@ func readCurrentUser() (userName string) { if err == nil { return usr.Username } - // Fall back to reading $HOME then $LOGNAME - userName = os.Getenv("HOME") + // Fall back to reading $USER then $LOGNAME + userName = os.Getenv("USER") if userName != "" { return userName }