1

I am looking to disable my root account for security purposes only in witch I use sudo for anything I use on my system that I need the root account for. Witch works fine for if I need to do anything within the terminal. But when I open YaST2 it ask me for the root password and not mine.

And I am wondering if I can set YaST up to use my password sense the root password wont work scene it will be disabled.

Update I use opensuse tumbleweed along with MATE desktop environment

3

Update: On KDE Plasma desktop it is possible to launch YaST and other tools which need root permission as non root user using the launcher.

Disclaimer: This won't let you run YaST from the launcher as non root user! But you will be able to start a YaST GUI from the terminal with sudo.

To run the graphical user interface for YaST as a normal user with sudo permission, follow the steps below:

Configure sudo for your non root user.

  1. Add your user to the wheel group by using the following commands:

    $ su
    

    and enter your root password.

    # usermod -aG wheel username
    
  2. Change your /etc/sudoers file by using

    # visudo
    

    Now comment in the line with %wheel by removing the preceding #

    ## Uncomment to allow members of group wheel to execute any command
    %wheel        ALL=(ALL)       ALL
    

    and comment out the two following lines by adding a preceding #

    ## This allows use of an ordinary user account for administration of a freshly
    ## installed system. When configuring sudo, delete the two
    ## following lines:
    # Defaults targetpw   # ask for the password of the target user i.e. root
    # ALL   ALL=(ALL) ALL   # WARNING! Only use this together with 'Defaults targetpw'!
    

    now find the already commented in line beginning with Defaults env_keep

    Defaults        env_keep = "LANG LC_ADDRESS LC_CTYPE ..."
    

    and add the words DISPLAY and XAUTHORITY to the end of the line but before the ". This will allow the normal user to start graphical user interfaces with root permission when using sudo.

    Defaults        env_keep = "... DISPLAY XAUTHORITY"
    

    you can now save and exit visudo.

  3. Leave the root session and lock the root user account by typing

    # exit
    $ sudo passwd -l root
    
    • and finally start a YaST Qt GUI from terminal by typing:

      sudo yast2 --qt

    • or if you prefer a GTK GUI

      sudo yast2 --gtk

  4. Now configure kdesu to use sudo instead of su

    • type this for configuring kdesu

      kwriteconfig5 --file kdesurc --group super-user-command --key super-user-command sudo
      
  5. Logout and Login again

For more information about the sudo configuration visit:

  • I can use yast with sudo in terminal, but configuring gksu to use sudo fails and stills ask me for the root password. – weezle1234 Jan 21 '18 at 21:56
  • The kdesu version works. Could you please update your question, by providing your openSUSE / SUSE version + used desktop environment? I will then look for a solution. – Maximilian Laule Jan 24 '18 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.