'rclone serve sftp' disconnects after a while using encrypted jottacloud

What is the problem you are having with rclone?

'rclone serve sftp' disconnects after a while using encrypted jottacloud (sftp no longer works after this error appears). frequency is about every 6-24 hours. restart of rclone fixes issue immediately. any way to make it auto restart if error?

What is your rclone version (output from rclone version)

rclone v1.49.0-088-g28cc2009-beta

  • os/arch: windows/amd64
  • go version: go1.12.3

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Windows 10 64bit

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

Jottacloud

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

rclone.exe serve sftp "JottaCrypt:" --addr :22 --user hidden --pass hidden --vfs-cache-max-size 100G

A log from the command with the -vv flag (eg output from rclone -vv copy /tmp remote:tmp)

2019/09/22 03:10:18 NOTICE: Loaded 0 authorized keys from "C:\Users\Admin\.ssh\authorized_keys"
2019/09/22 03:10:18 NOTICE: SFTP server listening on [::]:22
2019/09/23 16:20:19 ERROR : /: Dir.Stat error: couldn't list files: Get https://www.jottacloud.com/jfs/get-99812900/Jotta/Archive: oauth2: cannot fetch token: 400 Bad Request
Response: {"error":"invalid_grant","error_description":"The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."}
2019/09/23 16:20:25 ERROR : /: Dir.Stat error: couldn't list files: Get https://www.jottacloud.com/jfs/get-99812900/Jotta/Archive: oauth2: cannot fetch token: 400 Bad Request
Response: {"error":"invalid_grant","error_description":"The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."}
2019/09/23 16:20:37 ERROR : /: Dir.Stat error: couldn't list files: Get https://www.jottacloud.com/jfs/get-99812900/Jotta/Archive: oauth2: cannot fetch token: 400 Bad Request
Response: {"error":"invalid_grant","error_description":"The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."}
2019/09/23 16:20:51 ERROR : /: Dir.Stat error: couldn't list files: Get https://www.jottacloud.com/jfs/get-99812900/Jotta/Archive: oauth2: cannot fetch token: 400 Bad Request
Response: {"error":"invalid_grant","error_description":"The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."}
2019/09/23 16:21:02 ERROR : /: Dir.Stat error: couldn't list files: Get https://www.jottacloud.com/jfs/get-99812900/Jotta/Archive: oauth2: cannot fetch token: 400 Bad Request
Response: {"error":"invalid_grant","error_description":"The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."}
2019/09/23 16:21:08 ERROR : /: Dir.Stat error: couldn't list files: Get https://www.jottacloud.com/jfs/get-99812900/Jotta/Archive: oauth2: cannot fetch token: 400 Bad Request
Response: {"error":"invalid_grant","error_description":"The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."}
2019/09/23 16:21:14 ERROR : /: Dir.Stat error: couldn't list files: Get https://www.jottacloud.com/jfs/get-99812900/Jotta/Archive: oauth2: cannot fetch token: 400 Bad Request
Response: {"error":"invalid_grant","error_description":"The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."}
2019/09/23 16:21:20 ERROR : /: Dir.Stat error: couldn't list files: Get https://www.jottacloud.com/jfs/get-99812900/Jotta/Archive: oauth2: cannot fetch token: 400 Bad Request
Response: {"error":"invalid_grant","error_description":"The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."}
2019/09/23 16:21:26 ERROR : /: Dir.Stat error: couldn't list files: Get https://www.jottacloud.com/jfs/get-99812900/Jotta/Archive: oauth2: cannot fetch token: 400 Bad Request
Response: {"error":"invalid_grant","error_description":"The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."}
2019/09/23 16:21:32 ERROR : /: Dir.Stat error: couldn't list files: Get https://www.jottacloud.com/jfs/get-99812900/Jotta/Archive: oauth2: cannot fetch token: 400 Bad Request
Response: {"error":"invalid_grant","error_description":"The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."}
2019/09/23 16:24:05 ERROR : /: Dir.Stat error: couldn't list files: Get https://www.jottacloud.com/jfs/get-99812900/Jotta/Archive: oauth2: cannot fetch token: 400 Bad Request
Response: {"error":"invalid_grant","error_description":"The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."}
2019/09/23 16:24:11 ERROR : /: Dir.Stat error: couldn't list files: Get https://www.jottacloud.com/jfs/get-99812900/Jotta/Archive: oauth2: cannot fetch token: 400 Bad Request
Response: {"error":"invalid_grant","error_description":"The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."}

Are you transferring files continuously during the period? Or are there long idle periods?

The oauth2 should refresh itself either way though so I'm a bit puzzled as to what exactly is going on.

thanks for quick reply @ncw.
long idle periods usually, since I use it with Infuse (similar to Plex).
there were some issues recently with connecting to jottacloud using new api, which was fixed in latest beta (author called it a "quick fix" or something). unsure if it is related to that.
i could try and get the error output using '-vv', if that helps.

I also transfer files to Jotta every night using:
rclone.exe copy "C:\Users\Admin\Downloads" "JottaCrypt:" -vv --progress

I think that might be the problem, using the same jotta config simultansously.

Note this bit in the docs

Rclone has it's own Jottacloud API KEY which works fine as long as one only uses rclone on a single machine. When you want to use rclone with this account on more than one machine it's recommended to create a machine specific API key. These keys can NOT be shared between machines.

So I think you might have to make another jotta backend for use with the copy and one for use with the sftp if you are going to run them at the same time.

You could also use the sftp backend to copy to the rclone serve sftp which should work pretty well.

ok, I created a JottaSFTP: now which connects to SFTP localhost (when rclone serve sftp is running).
the timestamps of api errors are around ~16:20. the rclone copy is 05:00. so unsure if it's the cause.
will see if that works, appreciate the help.

The error messages are consistent with that problem - let's see if it helps :slight_smile:

1 Like