Xinetd and rclone --stdio

What is the problem you are having with rclone?

I am trying to client/server approach using Rclone behind xinetd. However, I cannot connect. Any help appreciated.

Server xinetd config is below.

service rclone-sftp
{
  disable = no
  socket_type = stream
  protocol = tcp
  port = 9000
  wait = no
  user = root
  server = /usr/bin/rclone
  server_args = serve sftp /home/***/temp --stdio --config="" --log-file=/tmp/rclone.log --log-level=DEBUG --retries=5 --low-level-retries=5
  type = UNLISTED
  log_on_success += HOST PID USERID
  log_on_failure += HOST USERID
}

Client command is below. Server log is given in “A log from the command with the -vv flag“ section.

Run the command 'rclone version' and share the full output of the command.

rclone v1.71.0

  • os/version: debian trixie/sid (64 bit)
  • os/kernel: 6.12.46-x64v3-xanmod1 (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.25.0
  • go/linking: static
  • go/tags: none

Which cloud storage system are you using? (eg Google Drive) Local

The command you were trying to run (eg rclone copy /tmp remote:tmp)

Client connect command:

rclone ls --sftp-host=127.0.0.1 --sftp-port=9000 :sftp:

The rclone config contents with secrets removed.

No config

A log from the command with the -vv flag

Server log:

2025/09/23 16:56:57 DEBUG : 5 go routines active
2025/09/23 16:56:57 NOTICE: Failed to sftp: completed with error: packet too long
2025/09/23 16:56:59 DEBUG : rclone: Version "v1.71.0" starting with parameters ["rclone" "serve" "sftp" "/home/denis/temp" "--stdio" "--config=\"\"" "--log-file=/tmp/rclone.log" "--log-level=DEBUG" "--retries=5" "--low-level-retries=5"]
2025/09/23 16:56:59 DEBUG : Creating backend with remote "/home/denis/temp"
2025/09/23 16:56:59 NOTICE: Config file "/\"\"" not found - using defaults
2025/09/23 16:56:59 INFO  : Local file system at /home/denis/temp: poll-interval is not supported by this remote
2025/09/23 16:56:59 DEBUG : stdio: Starting SFTP server
2025/09/23 16:56:59 INFO  :
Transferred:              0 B / 0 B, -, 0 B/s, ETA -
Errors:                 1 (retrying may help)
Elapsed time:         0.0s

2025/09/23 16:56:59 DEBUG : 5 go routines active
2025/09/23 16:56:59 NOTICE: Failed to sftp: completed with error: packet too long

Client log:

2025/09/23 16:18:23 CRITICAL: Failed to create file system for ":sftp:": NewFs: couldn't connect SSH: ssh: handshake failed: read tcp 127.0.0.1:58614->127.0.0.1:9000: read: connection reset by peer

welcome to the forum,

need to run all commands with debug output and post the full output. no one-line snippets.

fwiw, to simplify testing, run all commands on the command line, not using xinetd.

might test the following command
rclone ls --transfers=1 --sftp-host=127.0.0.1 --sftp-port=9000 :sftp:

Sorry. But I don’t get it. I provided the full xinetd config. It contains full server command line with debug enabled. –stdio parameter prevents server from starting from terminal.

Exactly the same issue. Nothing changed.

a bit confusing, as you re-edited your old post, added new info.

to simply testing, forget about xinetd, run all command direct in the terminal.


post the full debug log for rclone ls, not just a one line snippet.

$ rclone serve sftp /home/denis/temp --stdio --config="" --log-level=DEBUG --retries=5 --low-level-retries=5
2025/09/23 17:06:13 DEBUG : rclone: Version "v1.71.0" starting with parameters ["rclone" "serve" "sftp" "/home/denis/temp" "--stdio" "--config=" "--log-level=DEBUG" "--retries=5" "--low-level-retries=5"]
2025/09/23 17:06:13 DEBUG : Creating backend with remote "/home/denis/temp"
2025/09/23 17:06:13 DEBUG : Using config file from ""
2025/09/23 17:06:13 INFO  : 
Transferred:   	          0 B / 0 B, -, 0 B/s, ETA -
Errors:                 1 (retrying may help)
Elapsed time:         0.0s

2025/09/23 17:06:13 DEBUG : 4 go routines active
2025/09/23 17:06:13 NOTICE: Failed to sftp: refusing to run SFTP server directly on a terminal. Please let sshd start rclone, by connecting with sftp or sshfs
$ rclone ls --transfers=1 --config="" --sftp-host=127.0.0.1 --sftp-port=9000 :sftp: --log-level=DEBUG 
2025/09/23 17:07:31 DEBUG : rclone: Version "v1.71.0" starting with parameters ["rclone" "ls" "--transfers=1" "--config=" "--sftp-host=127.0.0.1" "--sftp-port=9000" ":sftp:" "--log-level=DEBUG"]
2025/09/23 17:07:31 DEBUG : Creating backend with remote ":sftp:"
2025/09/23 17:07:31 DEBUG : Using config file from ""
2025/09/23 17:07:31 DEBUG : :sftp: detected overridden config - adding "{eS_Or}" suffix to name
2025/09/23 17:07:31 DEBUG : pacer: low level retry 1/10 (error couldn't connect SSH: ssh: handshake failed: read tcp 127.0.0.1:36202->127.0.0.1:9000: read: connection reset by peer)
2025/09/23 17:07:31 DEBUG : pacer: Rate limited, increasing sleep to 200ms
2025/09/23 17:07:31 DEBUG : pacer: low level retry 2/10 (error couldn't connect SSH: ssh: handshake failed: read tcp 127.0.0.1:36214->127.0.0.1:9000: read: connection reset by peer)
2025/09/23 17:07:31 DEBUG : pacer: Rate limited, increasing sleep to 400ms
2025/09/23 17:07:31 DEBUG : pacer: low level retry 3/10 (error couldn't connect SSH: ssh: handshake failed: read tcp 127.0.0.1:36222->127.0.0.1:9000: read: connection reset by peer)
2025/09/23 17:07:31 DEBUG : pacer: Rate limited, increasing sleep to 800ms
2025/09/23 17:07:31 DEBUG : pacer: low level retry 4/10 (error couldn't connect SSH: ssh: handshake failed: read tcp 127.0.0.1:36230->127.0.0.1:9000: read: connection reset by peer)
2025/09/23 17:07:31 DEBUG : pacer: Rate limited, increasing sleep to 1.6s
2025/09/23 17:07:32 DEBUG : pacer: low level retry 5/10 (error couldn't connect SSH: ssh: handshake failed: read tcp 127.0.0.1:36238->127.0.0.1:9000: read: connection reset by peer)
2025/09/23 17:07:32 DEBUG : pacer: Rate limited, increasing sleep to 2s
2025/09/23 17:07:34 DEBUG : pacer: low level retry 6/10 (error couldn't connect SSH: ssh: handshake failed: read tcp 127.0.0.1:36242->127.0.0.1:9000: read: connection reset by peer)
2025/09/23 17:07:36 DEBUG : pacer: low level retry 7/10 (error couldn't connect SSH: ssh: handshake failed: read tcp 127.0.0.1:36256->127.0.0.1:9000: read: connection reset by peer)
2025/09/23 17:07:38 DEBUG : pacer: low level retry 8/10 (error couldn't connect SSH: ssh: handshake failed: read tcp 127.0.0.1:33310->127.0.0.1:9000: read: connection reset by peer)
2025/09/23 17:07:40 DEBUG : pacer: low level retry 9/10 (error couldn't connect SSH: ssh: handshake failed: read tcp 127.0.0.1:33320->127.0.0.1:9000: read: connection reset by peer)
2025/09/23 17:07:42 DEBUG : pacer: low level retry 10/10 (error couldn't connect SSH: ssh: handshake failed: read tcp 127.0.0.1:33336->127.0.0.1:9000: read: connection reset by peer)
2025/09/23 17:07:42 CRITICAL: Failed to create file system for ":sftp:": NewFs: couldn't connect SSH: ssh: handshake failed: read tcp 127.0.0.1:33336->127.0.0.1:9000: read: connection reset by peer

can you test without that.
and test another sftp client other than rclone.

$ rclone serve sftp /tmp/1111 --addr 127.0.0.1:9001 --config="" --user="test" --pass="test" --log-level=DEBUG --retries=5 --low-level-retries=5
2025/09/23 19:16:06 DEBUG : rclone: Version "v1.71.0" starting with parameters ["rclone" "serve" "sftp" "/tmp/1111" "--addr" "127.0.0.1:9001" "--config=" "--user=test" "--pass=test" "--log-level=DEBUG" "--retries=5" "--low-level-retries=5"]
2025/09/23 19:16:06 DEBUG : Creating backend with remote "/tmp/1111"
2025/09/23 19:16:06 DEBUG : Using config file from ""
2025/09/23 19:16:06 INFO  : Local file system at /tmp/1111: poll-interval is not supported by this remote
2025/09/23 19:16:06 NOTICE: Loaded 0 authorized keys from "/home/***/.ssh/authorized_keys"
2025/09/23 19:16:06 DEBUG : Loaded private key from "/home/***/.cache/rclone/serve-sftp/id_rsa"
2025/09/23 19:16:06 DEBUG : Loaded private key from "/home/***/.cache/rclone/serve-sftp/id_ecdsa"
2025/09/23 19:16:06 DEBUG : Loaded private key from "/home/***/.cache/rclone/serve-sftp/id_ed25519"
2025/09/23 19:16:06 NOTICE: SFTP server listening on 127.0.0.1:9001
2025/09/23 19:16:14 DEBUG : serve sftp 127.0.0.1:48440->127.0.0.1:9001: ssh auth "none" from "SSH-2.0-rclone/v1.71.0": ssh: no auth passed yet
2025/09/23 19:16:14 DEBUG : serve sftp 127.0.0.1:48440->127.0.0.1:9001: Password login attempt for test
2025/09/23 19:16:14 DEBUG : serve sftp 127.0.0.1:48440->127.0.0.1:9001: ssh auth "password" from "SSH-2.0-rclone/v1.71.0": OK
2025/09/23 19:16:14 INFO  : serve sftp 127.0.0.1:48440->127.0.0.1:9001: SSH login from test using SSH-2.0-rclone/v1.71.0
2025/09/23 19:16:14 DEBUG : serve sftp 127.0.0.1:48440->127.0.0.1:9001: Incoming channel: session
2025/09/23 19:16:14 DEBUG : serve sftp 127.0.0.1:48440->127.0.0.1:9001: Channel accepted
2025/09/23 19:16:14 DEBUG : serve sftp 127.0.0.1:48440->127.0.0.1:9001: Request: subsystem
2025/09/23 19:16:14 DEBUG : serve sftp 127.0.0.1:48440->127.0.0.1:9001: Subsystem: sftp
2025/09/23 19:16:14 DEBUG : serve sftp 127.0.0.1:48440->127.0.0.1:9001:  - accepted: true
2025/09/23 19:16:14 DEBUG : serve sftp 127.0.0.1:48440->127.0.0.1:9001: Starting SFTP server
2025/09/23 19:16:14 DEBUG : serve sftp 127.0.0.1:48440->127.0.0.1:9001: Incoming channel: session
2025/09/23 19:16:14 DEBUG : serve sftp 127.0.0.1:48440->127.0.0.1:9001: Channel accepted
2025/09/23 19:16:14 DEBUG : serve sftp 127.0.0.1:48440->127.0.0.1:9001: Request: exec
2025/09/23 19:16:14 DEBUG : serve sftp 127.0.0.1:48440->127.0.0.1:9001:  - accepted: true
2025/09/23 19:16:14 DEBUG : serve sftp 127.0.0.1:48440->127.0.0.1:9001: exec command: binary = "echo", args = "${ShellId}%ComSpec%"
2025/09/23 19:16:14 DEBUG : serve sftp 127.0.0.1:48440->127.0.0.1:9001: exited session
^C2025/09/23 19:16:31 INFO  : Signal received: interrupt
2025/09/23 19:16:31 INFO  : Exiting...
$ rclone ls --transfers=1 --config="" --sftp-user="test" --sftp-pass=$(echo "test" | rclone obscure -) --sftp-host=127.0.0.1 --sftp-port=9001 :sftp: --log-level=DEBUG 
2025/09/23 19:16:14 DEBUG : rclone: Version "v1.71.0" starting with parameters ["rclone" "ls" "--transfers=1" "--config=" "--sftp-user=test" "--sftp-pass=0ov-qQmOL2Mp6xsuK9y6dpVRGdo" "--sftp-host=127.0.0.1" "--sftp-port=9001" ":sftp:" "--log-level=DEBUG"]
2025/09/23 19:16:14 DEBUG : Creating backend with remote ":sftp:"
2025/09/23 19:16:14 DEBUG : Using config file from ""
2025/09/23 19:16:14 DEBUG : :sftp: detected overridden config - adding "{hl756}" suffix to name
2025/09/23 19:16:14 DEBUG : sftp://test@127.0.0.1:9001/: New connection 127.0.0.1:48440->127.0.0.1:9001 to "SSH-2.0-rclone/v1.71.0"
2025/09/23 19:16:14 DEBUG : sftp://test@127.0.0.1:9001/: Running shell type detection remote command: echo ${ShellId}%ComSpec%
2025/09/23 19:16:14 DEBUG : sftp://test@127.0.0.1:9001/: Remote command result: ${ShellId}%ComSpec%
2025/09/23 19:16:14 DEBUG : sftp://test@127.0.0.1:9001/: Shell type "unix" detected (set option shell_type to override)
2025/09/23 19:16:14 DEBUG : Saving config "shell_type" in section ":sftp" of the config file
2025/09/23 19:16:14 DEBUG : sftp://test@127.0.0.1:9001/: Relative path resolved to "/"
2025/09/23 19:16:14 DEBUG : sftp://test@127.0.0.1:9001/: Using root directory "/"
2025/09/23 19:16:14 DEBUG : fs cache: renaming cache item ":sftp:" to be canonical ":sftp{hl756}:"
        0 a
        0 b
        0 c
2025/09/23 19:16:14 DEBUG : 14 go routines active
2025/09/23 19:16:14 DEBUG : sftp://test@127.0.0.1:9001/: Closing 1 unused connections

“Direct“ sftp server connection works fine.

ok. good. all works direct on the command line.

is the issue with xinetd or with --stdio ?

now, i would re-run the same exact commands, in the terminal, but add --stdio and post the full debug logs for both.

One of those, or both. No idea.

I’ve already posted what server emits when run in terminal with –stdio.

See Xinetd and rclone --stdio - #5 by Denis_Golovan

??


and just curuous, why is --stdio required for your use-case?

I try to find some way to trigger ZFS snapshot creation on server BEFORE rclone bisync. Thus I need something to invoke my script and only after successful snapshot creation proceed with sync via rclone. And as I don’t use “systemd & like”, I am trying to rely on old & “true” xinetd which is specifically made for script interactions via stdin<–>sockets.

so, i am not familiar with zfs snapshots.
but why can you now create the snapshot, then run bisync. seems simple enough?

i do the same but on windows using VSS snapshots.
i have a handy, dandy wiki about that.
How to enable VSS for rclone on Windows

I’d like to get a fully automatic 2-way replication & backup/snapshots between 2+ Linux servers. Thus ZFS snapshots provide backups (yearly, monthly, etc.) as needed.

Other than that it’s pretty similar to VSS approach you’ve mentioned.

not sure i agree.

my script is very simple.

  1. starts the asynchronous process of creating a vss snapshot.
  2. loop until the snapshot is created
  3. run rclone
  4. delete the snapshot. tho technically a temporary vss snapshot will self-delete as a period of inactivity.
  5. live long and prosper...

Your script does not seem to snapshot destination for backup before starting (bi)sync. You are doing only source snapshot for rclone. So it’s not entirely true comparison.

Same issue can be reproduced when using ncat instead of xinetd.

Server output:

$ ncat -l 6000 -c 'rclone serve sftp /tmp --config="" --stdio --user="test" --pass="test" -vvv' --keep-open
2025/09/24 10:51:23 DEBUG : rclone: Version "v1.71.0" starting with parameters ["rclone" "serve" "sftp" "/tmp" "--config=" "--stdio" "--user=test" "--pass=test" "-vvv"]
2025/09/24 10:51:23 DEBUG : Creating backend with remote "/tmp"
2025/09/24 10:51:23 DEBUG : Using config file from ""
2025/09/24 10:51:23 INFO  : Local file system at /tmp: poll-interval is not supported by this remote
2025/09/24 10:51:23 DEBUG : stdio: Starting SFTP server
2025/09/24 10:51:23 INFO  : 
Transferred:   	          0 B / 0 B, -, 0 B/s, ETA -
Errors:                 1 (retrying may help)
Elapsed time:         0.0s

2025/09/24 10:51:23 DEBUG : 4 go routines active
2025/09/24 10:51:23 NOTICE: Failed to sftp: completed with error: packet too long

Client output:

$ rclone ls --transfers=1 --config="" --sftp-user="test" --sftp-pass=$(echo "test" | rclone obscure -) --sftp-host=localhost --sftp-port=6000 :sftp: --log-level=DEBUG 
2025/09/24 10:51:23 DEBUG : rclone: Version "v1.71.0" starting with parameters ["rclone" "ls" "--transfers=1" "--config=" "--sftp-user=test" "--sftp-pass=gzWBcZe5r80AJHYyn2fs6pUIHtQ" "--sftp-host=localhost" "--sftp-port=6000" ":sftp:" "--log-level=DEBUG"]
2025/09/24 10:51:23 DEBUG : Creating backend with remote ":sftp:"
2025/09/24 10:51:23 DEBUG : Using config file from ""
2025/09/24 10:51:23 DEBUG : :sftp: detected overridden config - adding "{NJUUB}" suffix to name
2025/09/24 10:51:23 DEBUG : pacer: low level retry 1/10 (error couldn't connect SSH: ssh: handshake failed: EOF)
2025/09/24 10:51:23 DEBUG : pacer: Rate limited, increasing sleep to 200ms
2025/09/24 10:51:23 DEBUG : pacer: low level retry 2/10 (error couldn't connect SSH: ssh: handshake failed: EOF)
2025/09/24 10:51:23 DEBUG : pacer: Rate limited, increasing sleep to 400ms
2025/09/24 10:51:23 DEBUG : pacer: low level retry 3/10 (error couldn't connect SSH: ssh: handshake failed: EOF)
2025/09/24 10:51:23 DEBUG : pacer: Rate limited, increasing sleep to 800ms
2025/09/24 10:51:24 DEBUG : pacer: low level retry 4/10 (error couldn't connect SSH: ssh: handshake failed: EOF)
2025/09/24 10:51:24 DEBUG : pacer: Rate limited, increasing sleep to 1.6s
2025/09/24 10:51:24 DEBUG : pacer: low level retry 5/10 (error couldn't connect SSH: ssh: handshake failed: EOF)
2025/09/24 10:51:24 DEBUG : pacer: Rate limited, increasing sleep to 2s
2025/09/24 10:51:26 DEBUG : pacer: low level retry 6/10 (error couldn't connect SSH: ssh: handshake failed: EOF)
2025/09/24 10:51:28 DEBUG : pacer: low level retry 7/10 (error couldn't connect SSH: ssh: handshake failed: EOF)
2025/09/24 10:51:30 DEBUG : pacer: low level retry 8/10 (error couldn't connect SSH: ssh: handshake failed: EOF)
2025/09/24 10:51:32 DEBUG : pacer: low level retry 9/10 (error couldn't connect SSH: ssh: handshake failed: EOF)
2025/09/24 10:51:34 DEBUG : pacer: low level retry 10/10 (error couldn't connect SSH: ssh: handshake failed: EOF)
2025/09/24 10:51:34 CRITICAL: Failed to create file system for ":sftp:": NewFs: couldn't connect SSH: ssh: handshake failed: EOF

It looks like rclone when ran in –stdio mode does not emit anything to stdout.

Posted to Rclone --stdio mode server · Issue #8849 · rclone/rclone · GitHub

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.