Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

sftp: read $USER in username fallback not $HOME

Nick Craig-Wood052c886317d1
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
}