Search code examples
sqldjangogoogle-cloud-platformgoogle-cloud-sql

Connect to google cloud SQL with django from google VM


I'm trying to connect to my google SQL database from my VM instance with django and I get the following error:

private key file "./Google Keys/client-key.pem" has group or world access; permis
sions should be u=rw (0600) or less

how can it be fixed?

(Note: it is working from my local machine but not from VM instance :/)


Solution

  • This is a security warning trying to help you keep your private key safe. On linux, you can modify the permissions of the file using the following command:

    chmod 600 "Google Keys/client-key.pem"
    

    This will limit who can read and write to the file, making it so unprivileged users won't be able to get at the contents. You can read more about chmod in the chmod man page.