philm / ansible_playbook

Docker Image for running Ansible Playbook commands
108 stars 78 forks source link

permission denied when using docker for windows #6

Open oppianmatt opened 7 years ago

oppianmatt commented 7 years ago

trying to mount in the private key but get the following error

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r\n@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @\r\n@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r\nPermissions 0555 for \'/root/.ssh/id_rsa\' are too open.\r\nIt is required that your private key files are NOT accessible by others.\r\nThis p
rivate key will be ignored.\r\nLoad key "/root/.ssh/id_rsa": bad permissions\r\nPermission denied (publickey).\r\n

docker-compose is using:

volumes:
      - '.:/ansible/playbooks'
      - "./id_rsa:/root/.ssh/id_rsa"

docker for windows

philm commented 7 years ago

If you install Git for Windows, you can use the git bash shell to change your local key permissions:

chmod 600 ~/.ssh/id_rsa

(Cygwin should work too here)

heyimalex commented 6 years ago

Hm, I don't think that works; my permissions are set correctly in cygwin and those files still end up being mounted with 0755. I got around it by mounting them to a different folder and changing the entrypoint to a shell script that copies them from the mount to ~/.ssh and then chmods them before running ansible-playbook.