Dmitry Porotnikov / One-liner to add new privileged user to Azure Linux VM using run command

Created Wed, 27 Mar 2024 11:02:42 +0000 Modified Wed, 27 Mar 2024 11:02:42 +0000
62 Words

One-liner to add new privileged user to Azure Linux VM using run command

When executed on an Azure VM running Linux (e.g from Run Command), this command effectively creates a new user named recovery, sets their password, and grants them sudo privileges.

sudo useradd -m recovery -s /bin/bash -p $(echo testpasswd1! | openssl passwd -1 -stdin) && sudo usermod -aG sudo recovery