Sudo

Sudo#

Migration to doas#

As an lightweight alternative to sudo you can use doas.

See also

  • doas - ArchWiki [1]

  • doas - ArchWiki - doas persist feature [2]

Warning

doas does not seem to be production ready. See [2]

  1. install the package

    apt-get install doas
    
  2. configure doas. Replace USER with your user

    /etc/doas.conf#
    1permit keepenv setenv { XAUTHORITY LANG LC_ALL } :wheel
    2permit persist keepenv ${USER}
    
  3. test it

    doas -s
    
  4. use this bash alias and function to convert sudo and sudo -i to the doas equivalents

    1function doas_to_sudo_interactive() {
    2    # rename alias
    3    [ "${1}" = '-i' ] && doas -s || doas ${1}
    4}
    5alias sudo='doas_to_sudo_interactive'
    
  5. If you want to remove sudo you have to set an environment variable first

    SUDO_FORCE_REMOVE=yes
    apt purge sudo
    

Footnotes