52

I was reading a guide to install some software and came reading until this shocking statement:

sudo is not installed on Debian by default. Make sure your system is up-to-date and install it.

As current Debian user, this is difficult to believe since from installation I'm able to use sudo. So, maybe it got installed when I selected not to create a password for the root account (rendering the root account disabled) or something is amiss here. Does Debian not include sudo (or it's variants) as installed by default?

If we go by what the other answer says, sudo can be installed due APT/DPKG dependencies, which in some cases will ask tasksel/apt to install those too, but isn't included in the required or important list:

➜  ~  aptitude search ~prequired | grep sudo
➜  ~  aptitude search ~pimportant | grep sudo
➜  ~  aptitude why '~prequired' sudo      
i A dpkg     Suggests   apt                             
i A apt      Suggests   aptitude | synaptic | wajig     
i A synaptic Recommends gksu | kdebase-bin | policykit-1
i A gksu     Depends    sudo                            
➜  ~  aptitude why '~pimportant' sudo           
i A apt      Suggests   aptitude | synaptic | wajig     
i A synaptic Recommends gksu | kdebase-bin | policykit-1
i A gksu     Depends    sudo                            
Braiam
  • 35,991

1 Answers1

67

This is a side-effect of installation parameters. If you specify a root password during installation sudo is not installed by default. If you do not specify a root password, sudo is installed. The authoritative source for this quoted below. Another related special case is that during install if you specify the sudo-ldap package, sudo will not be installed. This is the only time that sudo-ldap can be installed without a root password. If you wish to upgrade from sudo to sudo-ldap latter, you must have a root password during the upgrade.

If you do not specify a password for the root user this account will be disabled but the sudo package will be installed later to enable administrative tasks to be carried out on the new system. -- from debian-installer/manual/en/howto/installation-howto.xml

hildred
  • 5,829
  • 3
  • 31
  • 43
  • 1
    or you could chroot from a live cd and do the upgrade. or sudo -i. – strugee Dec 30 '13 at 21:23
  • 4
    Nope, dosn't work. When apt tries to install sudo-ldap or upgrade sudo to sudo-ldap, becouse sudo and sudo-ldap conflict it first uninstalls sudo before installing sudo-ldap and sudo's uninstall scripts fail unless a root password is defined. This is not hard to get around, just make sure root has a password while doing this, and then remove it. – hildred Dec 30 '13 at 21:31
  • 1
    Here is a nice guide to adding SUDO: https://www.privateinternetaccess.com/forum/discussion/18063/debian-8-1-0-jessie-sudo-fix-not-installed-by-default – raider33 Apr 15 '16 at 12:53
  • Installation Guide link where this is mentioned: https://www.debian.org/releases/jessie/amd64/apas03.html.en – CrazyPenguin Aug 24 '16 at 02:29
  • The setup is performed by user-setup-ask and user-setup-apply in user-setup. – Stephen Kitt Feb 28 '17 at 09:05