sftp: read $USER in username fallback not $HOME
This commit is contained in:
parent
28480c0570
commit
052c886317
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue