Solved: Amazon S3: Fatal: unable to open config file: Stat: Access Denied

Hi there,
I’ve been using restic for about 2 years now to backup my laptop to Amazon S3. I use it via a script:

# IAM user macbook-pro-backup
export AWS_ACCESS_KEY_ID="xxx"
export AWS_SECRET_ACCESS_KEY="xxxx"
export AWS_DEFAULT_REGION="us-east-1"

restic backup --verbose \
    --password-file /home/atodorov/restic.password \
    --exclude-file /home/atodorov/exclude.rules \
    -r s3://s3.amazonaws.com/backup ~/

I am switching computers today and this script was working about 3hrs ago for the last time.

  1. Executed the script from the old laptop - all GOOD
  2. rsynced all data between old and new laptop via ssh
  3. Verified new laptop looks good.
  4. Executed the above script from the new laptop after I was done with the old one. That was around 3hrs ago. (I may have executed this one as root by mistake but I’m not sure).

Then I was installing more items and doing general cleanup on the new machine, adding this script into crontab, etc. At the end of the day I figured it would be a good idea to execute the script once more.

Now I am getting errors:

./restic.backup.sh 
open repository
Fatal: unable to open config file: Stat: Access Denied.
Is there a repository at the following location?
s3://s3.amazonaws.com/backup

I’m not sure what that means or where to begin debugging even.

Obvious thing that comes to mind is that versions of restic on the 2 machines are different if that matters.

Any pointers ?

Update 1: I remembered that time on the new machine was misconfigured and it was off by 4-5 hours. That was been corrected after the successful execution of restic in step 4).

FTR I found out that the real-time clock on this system was way off and system time was also off by 20 or so minutes.

The moment I adjusted the timezone, rtc and system time and enabled NTP sync restic started working just fine.

2 Likes