AWS CLI Errno 13 Permission Denied, cannot set credentials using aws configure command

first time question so please excuse my poor question formatting. I'm running up to date(enough) Python, AWS CLI v2, installed with MSI, config and credentials file both have values, no environment variables set, Windows 10, using Command Prompt.

When I input:

C:\Users\correctuser> aws --version

This is what returns:

aws-cli/2.5.2 Python/3.9.11 Windows/10 exe/AMD64 prompt/off

When I type:

C:\Users\correctuser> aws configure list

This is what I get:

      Name                    Value             Type    Location
      ----                    -----             ----    --------
   profile                <not set>             None    None
access_key                <not set>             None    None
secret_key                <not set>             None    None
    region                us-west-2      config-file    ~/.aws/config

//I have both regular and secret access keys set in the 'credentials' file in C:\users\correctuser.aws\credentials, and the region and format set in C:\users\correctuser.aws\config.

[default]
region = us-west-2
output = json

[default]
aws_access_key_id = thisisfakeaccesskeyID
aws_secret_access_key = thisisfakesecretaccesskeyID


And then when I type:

C:\Users\GitUser>aws configure
AWS Access Key ID [None]: thisisfakeaccesskeyID
AWS Secret Access Key [None]: thisisfakesecretaccesskeyID
Default region name [us-west-2]:
Default output format [json]:

[Errno 13] Permission denied: 'c:\\users\\GitUser\\.aws'

I heard that sometimes when your file name doesn't have a backslash at the end of it that can cause an error, though I don't think that's what it is. I've also tried running Command Prompt as administrator and that didn't help.

What do y'all think?

Upvotes: 3

Views: 9968

Answers (2)

Benemortasia
Benemortasia

Reputation: 1

I first tried to give the permissions but also that did not fix the error at first.

When I checked the location the config.ini and credentials.ini did not exist.

After creating the files by editing a text file and saving it as the .ini files.

The error disappeared from that moment.

Upvotes: 0

To fix the problem you have to give write permission to the file.

If you run on unix/OSX

// Set permission
sudo chmod -R 777 /{Your_Path}/.aws/credentials 
sudo chmod -R 777 /{Your_Path}/.aws/config

Windows

1:- Right-click on the target file and select properties then select Security Tab

2:- Click Advanced and then make sure inheritance is disabled.

3:- Click apply and then click Edit in the security menu

4:- Remove all users except Admin user, which should have full control *Admin account should have all checkboxes checked on Allow column except special permission.

5:- Click Apply and then click OK.

Upvotes: 3

Related Questions