Automatically adding shell_type paramater removes comments at the end -> breaking Ansible provisioning

What is the problem you are having with rclone?

When using SFTP backend and not specifying a shell_type a detected shell type will be automatically added once the backend is used.

Whats the trouble?
I am using Ansible to write the rclone conf file. When first created it looks like this:


type = sftp
host = 192.168.x.y
user = 4711
pass = xyz


After the first time the backend is used it looks like this:


type = sftp
host = 192.168.x.y
user = 4711
pass = xyz
shell_type = unix

The problem is that the comment at the end is removed. Is this intention? Because it breaks Ansible provisioning.


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

rclone v1.61.0

- os/version: debian 11.5 (64 bit)

- os/kernel: 5.15.60-2-pve (x86_64)

- os/type: linux

- os/arch: amd64

- go/version: go1.19.4

- go/linking: static

- go/tags: none

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


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

Paste command here

The rclone config contents with secrets removed.

Paste config here

A log from the command with the -vv flag

Paste  log here

this has been discused a few times in the forum.

i had a similar issue

rclone is trying to add shell_type = unix so why not just add it yourself.
then rclone will not modify the config file.
and when rclone runs the first command on nas_photos_manager:, rclone will often add something like

md5sum_command = md5sum
sha1sum_command = sha1sum

Oh I am sorry. I must admit that I did not search the forum but the issue tracker and did not find a suitable one. Maybe I was not thoroughly enough. Spent a hard day on switching the backend from FTP to SFTP as you saw in other posts :smiley:

Thanky anyway also for the additional parameters I better add beforehand...

yes, i did see, you are making good progress

sure, when using a token based remote, such as gdrive, when the token expires, rclone has to re-write the config file.

another option, something i do alot, is not to use a config file at all.
instead create an on-the-fly remote.
rclone copy :sftp, /tmp/dir

Hm. Sounds interesting. But I guess this is not the best solution for my usecase (at least from what I think that I know right now :-D)
I use RClone to mount storage sitting on a NAS from within a hypervisor and then pass-through it to containers. Therefore I use the fstab mount way on the hypervisor to have a reliableconnection to the backend when it is needed (like with the noauto mount option).

But I might be mistaken and your solution is appropriate as well. I will have a look.

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