AlpineLinux 3.8: sudo without password

This article will describe how to omit sudo password. This will enable scripts with sudo be automated.

Table of Contents

  • 1. Install sudo
  • 2. Disable root login

1 Install sudo

Install sudo and add user to wheel group. Run visudo and edit /etc/sudoers and delete comment at the %wheel.

# apk add sudo
# adduser lehungio wheel
# sed -e 's;^# \(%wheel.*NOPASSWD.*\);\1;g' -i /etc/sudoers

2 Disable root login

Lock out root account with passwd -l and delete root password with passwd -d. You can change to root with sudo su – after this.

$ sudo passwd -l root
$ sudo passwd -d root