# New user: calf:admin groupadd admin useradd -g admin calf chsh -s /bin/bash calf mkhomedir_helper calf chmod +w /etc/sudoers vim /etc/sudoers # add a line: # calf ALL=(ALL) NOPASSWD: ALL chmod -w /etc/sudoers
# Setup ssh-key su - calf pwd # /home/calf ssh-keygen -t ed25519 vim .ssh/authorized_keys # add local machine's pub key into this file, then save chmod 644 .ssh/authorized_keys
# Disable password login, disable root login sudo vim /etc/ssh/sshd_config # make sure these settings: # PasswordAuthentication no # PermitRootLogin no # KbdInteractiveAuthentication no sudo sshd -t sudo service ssh reload
Azure Specific
By default, the root user is not allowed to log in via SSH.
In case if really needed, modify .ssh/authorized_keys, comment out the following line then add public key:
1
no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo 'Please login as the user \"calf\" rather than the user \"root\".';echo;sleep 10;exit 142" ssh-ed25519 ......
# Add Docker's official GPG key: # sudo apt-get install ca-certificates #> ca-certificates is already the newest version (20240203). # sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources: echo"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update
# To install the latest version of docker. sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
docker --version #> Docker version 28.3.0, build 38b7060 docker compose version #> Docker Compose version v2.37.3
service docker status
To allow non-privileged users to run Docker commands:
1 2 3 4 5 6
sudo usermod -aG docker USER
# Log out and log back in so that your group membership is re-evaluated. # Try `docker ps` without `sudo`. docker ps #> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES