![]() ![]() Sed -r -i.azbackup "s/$\:/g" /recovery/etc/shadow # Remove the root password from the /recovery/etc/shadow file. # Make a backup of the current /recovery/etc/shadow file.Ĭp -av /recovery/etc/shadow /recovery/etc/shadow.$( date '+%Y.%m.%d_%H.%M.%S' ) It can be "root" or the name of the admin user. # Make sure that password authentication is enabled on the OpenSSH server if you will try to log in to the server by using SSH and password authentication.Įgrep "^PasswordAuthentication" /recovery/etc/ssh/sshd_config # If the output from lsblk shows that the root file system is located on a logical volume, then you have to mount that logical volume instead. # Mount the OS disk that's attached as a data disk to the recovery VM. # Identify the device name of the data disk that's attached to the VM. # You have to run the following commands as the root user. Mount the root file system on the data disk on /recovery, and set the password field a blank state. AZ_RESOURCE_GROUP="YourResourceGroupName"Īz vm repair create -g $AZ_RESOURCE_GROUP -n $AZ_VM_NAME -repair-username $AZ_ADMIN_USER -repair-password "$AZ_MSADMIN_PASS" -verbose This will create a copy of the OS disk, and attach the disk to a recovery VM automatically. Run following az vm repair create commands. For more information, see Snapshot a disk. Take a snapshot of the OS disk of the affected VM as a backup. Instead, you must contact the vendor of the network virtual appliance to get instructions about how to do a password reset safely. If you are experiencing problems that affect an Azure network virtual appliance, this method does not apply to your situation. This method has been tested by using the supported Linux distributions and versions. Reset the password by using a recovery VM You can also reset the password or SSH key by using the Reset Password feature in the Azure portal. To update the SSH key, see Manage administrative users, SSH by using the VMAccess Extension with the Azure CLI. Set up the environment variables, and use the Azure CLI or Azure Cloud Shell to do the password reset: AZ_RESOURCE_GROUP="YourResourceGroupName"Īz vm user update -u $AZ_ADMIN_USER -p $AZ_MSADMIN_PASS -g $AZ_RESOURCE_GROUP -n $AZ_VM_NAME ![]() Make sure that the Azure Linux Agent (waagent) service is running on the affected VM. This method requires that the Azure Linux Agent be installed on the affected VM. You can reset the password without attaching the OS disk to another VM. Reset the password by using Azure Linux Agent If the user account is expired or you want to create a new account, you can use the following methods to create a new local admin account and regain access to the VM. This article provides two methods to reset local Linux Virtual Machine (VM) passwords. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |