DescriptionEmanuele Giuseppe Esposito
2021-08-19 21:59:12 UTC
Description of problem:
In upstream PR #956 and BZ 1862967, we updated the file and directory permissions for keys not in
the user's home directory. We also unintentionally modified the
owner within the home directory as well to root, but only when the file/folders specified in AuthorizedKeysFile don't exist. This is okay and still allows ssh login, but not ideal for other ssh components. For example, if cloud-init creates the .ssh folder in /home/user/, the owner of .ssh will be root and ssh-keygen won't allow to create ssh keys in that folder.
LP: #1940233
Version-Release number of selected component (if applicable):
cloud-init-21.1-6.el8
How reproducible:
always
Steps to Reproduce:
1. Use standard AuthorizedKeysFile:
# cat /etc/ssh/sshd_config | grep AuthorizedKeysFile
AuthorizedKeysFile .ssh/authorized_keys
2. Remove ~/.ssh
3. Remove /var/lib/cloud/instance/sem/config_ssh
4. systemctl restart cloud-init ; systemctl restart sshd
5. Try to ssh login through the cloud-init created user, login is fine
6. run ssh-keygen and save the key in /home/<user>/.ssh
Actual results:
ssh-keygen gives Permission denied on the .ssh folder
This is because the owner of .ssh is root.
Expected results:
ssh-keygen creates the keys, and .ssh is owned by the user
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory (cloud-init bug fix and enhancement update), and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHEA-2021:4294