i want to prevent all the users from becoming a root user

i have a user called sohaib i removed him from the sudo group using

gpasswd -d sohaib sudo 

and also i've edited the /etc/sudoers file , i have commented the

# Allow members of group sudo to execute any command
%sudo  ALL=(ALL:ALL) ALL

but the user still can use the

sudo -i 

and become a root , i don't wanna any user to become a root including the first created user too (sohab)

  • 1
    perhaps there's a file in the /etc/sudoers.d folder granting the user sudo access Jan 15, 2023 at 0:28
  • you are right , I've find a 90-cloud-init-users file that has some rules , it grants that user access without a password
    – SohaibMan
    Jan 15, 2023 at 0:33

1 Answer 1


The solution was to also change all the relevant files in the /etc/sudoers.d directory, specifically a file called 90-cloud-init-users.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .