Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue creating /etc/htpasswd as requested: [Errno 13] Permission denied: b'/etc/htpasswd' #22

Open
Alynsk1 opened this issue Feb 7, 2020 · 3 comments

Comments

@Alynsk1
Copy link

Alynsk1 commented Feb 7, 2020

When i run
ansible-playbook server.yml -e env=staging -vvv
i get this error

TASK [bedrock-site-protect : Creating htpasswd folder] ************************************************************************************************************************************************************** task path: /.../trellis/vendor/roles/bedrock-site-protect/tasks/install.yml:9 Using module file /Library/Python/2.7/site-packages/ansible/modules/files/file.py Pipelining is enabled. <xxx.xxx.xxx.xxx> ESTABLISH SSH CONNECTION FOR USER: admin <xxx.xxx.xxx.xxx> SSH: EXEC ssh -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/Users/.../.ansible/cp/8105218663 xxx.xxx.xxx.xxx '/bin/sh -c '"'"'python3 && sleep 0'"'"'' <xxx.xxx.xxx.xxx> (1, '\n{"msg": "There was an issue creating /etc/htpasswd as requested: [Errno 13] Permission denied: b\'/etc/htpasswd\'", "path": "/etc/htpasswd", "failed": true, "invocation": {"module_args": {"group": "root", "dest": "/etc/htpasswd", "state": "directory", "mode": 493, "owner": "root", "path": "/etc/htpasswd", "recurse": false, "force": false, "follow": true, "modification_time_format": "%Y%m%d%H%M.%S", "access_time_format": "%Y%m%d%H%M.%S", "_original_basename": null, "_diff_peek": null, "src": null, "modification_time": null, "access_time": null, "seuser": null, "serole": null, "selevel": null, "setype": null, "attributes": null, "content": null, "backup": null, "remote_src": null, "regexp": null, "delimiter": null, "directory_mode": null, "unsafe_writes": null}}}\n', '') <xxx.xxx.xxx.xxx> Failed to connect to the host via ssh: System info: Ansible 2.8.8; Darwin Trellis 1.3.0: December 7th, 2019

@louim
Copy link
Owner

louim commented Feb 7, 2020

Hey @Alynsk1 ,

It seems like the playbook doesn't have the permission to create the folder there. I see in the error payload various references to "selinux", would you happen to use it? It's a wild guess, but that may be causing the problem you see?

You can also change the path where the files are created by setting the htpasswd_path variable:

htpasswd_path: /etc/htpasswd

Maybe you could try some other path to see if you encounter the same problem?

@Alynsk1
Copy link
Author

Alynsk1 commented Feb 8, 2020

Hi @louim ,

I run macos mojave 10.14.6
The box is on Ubuntu 18.04.3 (LTS) x64

I have try to change the path to srv/www/htpasswd and i still got a permission error.

I think I got an error with passlib missing from Trellis install on my first run (version 2.0.0) and I resolve by adding to trellis/group_vars/all/main.yml

apt_packages_custom:
  python3-passlib: present

as mentionned in Issue #15

Maybe there is a link between the two.

I have this set to false in trellis/group_vars/all/security.yml

sshd_permit_root_login: false
sshd_password_authentication: false

if there could be a problem here.

I think I will try a fresh Trellis and try to push to a new droplet to see if i still got the error.

@Alynsk1
Copy link
Author

Alynsk1 commented Feb 12, 2020

Hi @louim ,

I made a fresh install of Trellis and reinstall the role.

Now I have this error output
TASK [bedrock-site-protect : Set Nginx Auth Type] ****************************** changed: [xxx.xxx.xxx.xxx] => (item=example.com) ERROR! The requested handler 'reload nginx' was not found in either the main handlers list nor in the listening handlers list exit status 1

I'm I suppose to see a Handler in
⁨trellis⁩/⁨roles⁩/⁨nginx⁩/tasks⁩ ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants