-
Notifications
You must be signed in to change notification settings - Fork 153
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
authorized_key: user option is not respected/does not work as expected #483
Comments
A workaround exists by adding
|
The problem comes from the fact you use the I don't think this is something that can easily be changed because it people may rely on the current behaviour and be surprised by a subtle change. |
I did what you suggested and removed Could you explain to me why it works when using the implicit default value but not when specifying the same value explicit, please? I would like to understand it. |
But docs say that if you don't specify the I guess the relevant part in source is in file
So if I don't specify |
I think it's unclearance in writing documentation. Are you agree with me @Tronde @goneri ? |
LGTM. |
Docs/authorized_key: clarify that the path key should probably NOT be set SUMMARY Docs: Fixed unclearance in documentation connected wirh relative path Added additional description in documentation. ISSUE TYPE Docs Pull Request COMPONENT NAME authorized_key.py ADDITIONAL INFORMATION Clarify the documentation unclearance in connected with relative path ~/.ssh/authorized_keys The purpose of the pull request is to eliminate ambiguities in the documentation. In our case, when using the ~ sign, we get the user's root directory (although we explicitly specify a different username) Here is the issue and full picture of problem which we want to fix: LINK Closese: #483 Reviewed-by: Gonéri Le Bouder <[email protected]> Reviewed-by: atom4git Reviewed-by: Hideki Saito <[email protected]>
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [ansible.posix](https://redirect.github.com/ansible-collections/ansible.posix) | galaxy-collection | minor | `1.5.4` -> `1.6.0` | --- ### Release Notes <details> <summary>ansible-collections/ansible.posix (ansible.posix)</summary> ### [`v1.6.0`](https://redirect.github.com/ansible-collections/ansible.posix/blob/HEAD/CHANGELOG.rst#v160) [Compare Source](https://redirect.github.com/ansible-collections/ansible.posix/compare/1.5.4...1.6.0) \====== ## Release Summary This is the minor release of the `ansible.posix` collection. This changelog contains all changes to the modules and plugins in this collection that have been added after the release of `ansible.posix` 1.5.4. ## Major Changes - Dropping support for Ansible 2.9, ansible-core 2.15 will be minimum required version for this release ## Minor Changes - Add summary_only parameter to profile_roles and profile_tasks callbacks. - firewalld - add functionality to set forwarding ([https://github.com/ansible-collections/ansible.posix/pull/548](https://redirect.github.com/ansible-collections/ansible.posix/pull/548)). - firewalld - added offline flag implementation ([https://github.com/ansible-collections/ansible.posix/pull/484](https://redirect.github.com/ansible-collections/ansible.posix/pull/484)) - firewalld - respawn module to use the system python interpreter when the `firewall` python module is not available for `ansible_python_interpreter` ([https://github.com/ansible-collections/ansible.posix/pull/460](https://redirect.github.com/ansible-collections/ansible.posix/pull/460)). - firewalld_info - Only warn about ignored zones, when there are zones ignored. - firewalld_info - respawn module to use the system python interpreter when the `firewall` python module is not available for `ansible_python_interpreter` ([https://github.com/ansible-collections/ansible.posix/pull/460](https://redirect.github.com/ansible-collections/ansible.posix/pull/460)). - mount - add no_log option for opts parameter ([https://github.com/ansible-collections/ansible.posix/pull/563](https://redirect.github.com/ansible-collections/ansible.posix/pull/563)). - seboolean - respawn module to use the system python interpreter when the `selinux` python module is not available for `ansible_python_interpreter` ([https://github.com/ansible-collections/ansible.posix/pull/460](https://redirect.github.com/ansible-collections/ansible.posix/pull/460)). - selinux - respawn module to use the system python interpreter when the `selinux` python module is not available for `ansible_python_interpreter` ([https://github.com/ansible-collections/ansible.posix/pull/460](https://redirect.github.com/ansible-collections/ansible.posix/pull/460)). ## Removed Features (previously deprecated) - skippy - Remove skippy pluglin as it is no longer supported([https://github.com/ansible-collections/ansible.posix/issues/350](https://redirect.github.com/ansible-collections/ansible.posix/issues/350)). ## Bugfixes - Bugfix in the documentation regarding the path option for authorised_key([https://github.com/ansible-collections/ansible.posix/issues/483](https://redirect.github.com/ansible-collections/ansible.posix/issues/483)). - seboolean - make it work with disabled SELinux - synchronize - maintain proper formatting of the remote paths ([https://github.com/ansible-collections/ansible.posix/pull/361](https://redirect.github.com/ansible-collections/ansible.posix/pull/361)). - sysctl - fix sysctl to work properly on symlinks ([https://github.com/ansible-collections/ansible.posix/issues/111](https://redirect.github.com/ansible-collections/ansible.posix/issues/111)). </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://redirect.github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC43Ny4wIiwidXBkYXRlZEluVmVyIjoiMzguNzcuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsicmVub3ZhdGUvYW5zaWJsZSIsInR5cGUvbWlub3IiXX0=--> Co-authored-by: lumiere-bot[bot] <98047013+lumiere-bot[bot]@users.noreply.github.com>
SUMMARY
After a user account was created by using the modules
ansible.builtin.group
andansible.builtin.user
I would like to useansible.posix.authorized_key
with theuser
option to configure theauthorized_keys
file of this new created user. But instead of the users'sauthorized_keys
file the one ofroot
is edited instead.ISSUE TYPE
COMPONENT NAME
authorized_key
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Target OS version: Debian GNU/Linux 12 (bookworm) and Red Hat Enterprise Linux 9.2 (Plow)
STEPS TO REPRODUCE
I have the following test node in my Ansible
inventory
:test-vm1 ansible_host=192.168.1.226 ansible_user=root ansible_python_interpreter=/usr/bin/python3.11
On this host I would like to create a user and configure the
authorized_keys
file using the following playbook.EXPECTED RESULTS
User tronde should have an
authorized_keys
file that includes the specified SSH public key.So the file
/home/tronde/.ssh/authorized_keys
should be created and configured.ACTUAL RESULTS
The file
/root/.ssh/authorized_keys
is edited though"user": "tronde"
is set. Ownership and file mode are set in a way that locks out root immediatly.As you can see the file
/root/.ssh/authorized_keys
was edited though"user": "tronde"
was set. Ownership and file mode were set in a way that locks out root immediatly.In case any additional information is necessary to solve this issue, please don't hesitate to reach out.
Best regards,
Tronde
The text was updated successfully, but these errors were encountered: