sftp: read $USER in username fallback not $HOME

This commit is contained in:
Nick Craig-Wood 2018-01-08 21:39:16 +00:00
parent 28480c0570
commit 052c886317

View file

@ -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
}