Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1678636

Summary: [WALA]If user exists, public key should be added in but not overwrite authorized_keys
Product: Red Hat Enterprise Linux 6 Reporter: Yuxin Sun <yuxisun>
Component: WALinuxAgentAssignee: Vitaly Kuznetsov <vkuznets>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.10CC: danis, wshi, yujiang
Target Milestone: rcKeywords: Extras
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-27 11:54:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Yuxin Sun 2019-02-19 09:28:42 UTC
# This bug comes from upstream: https://github.com/Azure/WALinuxAgent/pull/1349
(Currently we cannot set multiple public keys while provisioning VM, so use another way to hit this issue)

Description of problem:
If user exists in VM image, the existing authorized_keys file will be overwritten. 

Version-Release number of selected component (if applicable):
WALinuxAgent-2.2.18-1

How reproducible:
100%

Steps to Reproduce:
1. Prepare a VM in Azure with existing user authorized_keys. (such as /home/azureuser/.ssh/authorized_keys)
2. Deprovision this VM(without removing user account)
# waagent -deprovision -force
3. Create a new VM base on this image with the same user account
# az vm create -g yuxisun -n yuxisun6ond1-4 --image "https://yuxisun.blob.core.windows.net/test/osdisk_b4617c3e7b.vhd" --admin-username azureuser --ssh-key-value ~/.ssh/id_rsa.pub --os-type linux --size Standard_D1_v2 --vnet-name yuxisun --subnet yuxisun --use-unmanaged-disk --storage-account yuxisun --storage-container-name test
4. Login and check /home/azureuser/.ssh/authorized_keys

Actual results:
The /home/azureuser/.ssh/authorized_keys is overwritten. 

Expected results:
The new public key should be added into /home/azureuser/.ssh/authorized_keys. It  should contain both old key and new key.

Additional info:
Fixed in upstream v2.2.34