Repository: rclone/rclone (language: go)

Issue:
Rclone mounting fails when done by pam_mount
<!--

We understand you are having a problem with rclone; we want to help you with that!

**STOP and READ**
**YOUR POST WILL BE REMOVED IF IT IS LOW QUALITY**:
Please show the effort you've put into solving the problem and please be specific.
People are volunteering their time to help! Low effort posts are not likely to get good answers!

If you think you might have found a bug, try to replicate it with the latest beta (or stable).
The update instructions are available at https://rclone.org/commands/rclone_selfupdate/

If you can still replicate it or just got a question then please use the rclone forum:

    https://forum.rclone.org/

for a quick response instead of filing an issue on this repo.

If nothing else helps, then please fill in the info below which helps us help you.

**DO NOT REDACT** any information except passwords/keys/personal info.

You should use 3 backticks to begin and end your paste to make it readable.

Make sure to include a log obtained with '-vv'.

You can also use '-vv --log-file bug.log' and a service such as https://pastebin.com or https://gist.github.com/

Thank you

The Rclone Developers

-->

#### What is the problem you are having with rclone?

I want to use pam_mount to automatically mount a Proton Drive directory using Rclone, decrypting the Rclone configuration file using my login password. An error occurs when attempting to do this.

```
sddm-helper[1436]: (mount.c:68): Messages from underlying mount program:
sddm[1436]: (mount.c:68): Messages from underlying mount program:
sddm[1436]: (mount.c:72): Enter configuration password:
sddm[1436]: (mount.c:72): password:2025/03/29 14:46:36 CRITICAL: Failed to read line: EOF
sddm-helper[1436]: (mount.c:72): Enter configuration password:
sddm-helper[1436]: (mount.c:72): password:2025/03/29 14:46:36 CRITICAL: Failed to read line: EOF
sddm-helper[1436]: (pam_mount.c:522): mount of Proton:/Sync failed
sddm[1436]: (pam_mount.c:522): mount of Proton:/Sync failed
```

Rclone's behavior is to throw an error whenever it encounters and EOF in stdin, even if a password was entered.

```
// fs/config/ui.go
line, err := buf.ReadString('\n')
if err != nil {
	fs.Fatalf(nil, "Failed to read line: %v", err)
}
```

I have found and tested a fix that would ignore EOFs if the read string is not empty, and will submit a PR shortly.

#### What is your rclone version (output from `rclone version`)

```
rclone v1.69.1
- os/version: arch (64 bit)
- os/kernel: 6.13.8-arch1-1 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.24.0
- go/linking: dynamic
- go/tags: none
```

#### Which OS you are using and how many bits (e.g. Windows 7, 64 bit)

Arch Linux x86_64

#### Which cloud storage system are you using? (e.g. Google Drive)

Proton Drive

#### The command you were trying to run (e.g. `rclone copy /tmp remote:tmp`)

I assume under-the-hood this would be `mount.rclone Proton:/Sync /home/samantha/Mounts/Proton/Sync -o config=/home/samantha/.config/rclone/rclone.conf,vfs_cache_mode=writes`.

<!--- Please keep the note below for others who read your bug report. -->

#### How to use GitHub

* Please use the 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to show that you are affected by the same issue.
* Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
* Subscribe to receive notifications on status change and new comments.



Discussion / hints:

Fix patch:
diff --git a/fs/config/ui.go b/fs/config/ui.go
index 6092fbae181df..226a8f832ca51 100644
--- a/fs/config/ui.go
+++ b/fs/config/ui.go
@@ -7,6 +7,7 @@ import (
 	"context"
 	"errors"
 	"fmt"
+	"io"
 	"os"
 	"slices"
 	"sort"
@@ -28,7 +29,7 @@ import (
 var ReadLine = func() string {
 	buf := bufio.NewReader(os.Stdin)
 	line, err := buf.ReadString('\n')
-	if err != nil {
+	if err != nil && (line == "" || err != io.EOF) {
 		fs.Fatalf(nil, "Failed to read line: %v", err)
 	}
 	return strings.TrimSpace(line)


Test patch: