1

How to make Ubuntu ask for a password every time a user tries to access system settings?

I need this specifically for the wifi settings, so that no one can change, turn on, or off wifi on my machine without putting the root password in the prompt.

Any help is appreciated.

Zanna
  • 69,223
  • 56
  • 216
  • 327
  • 1
    Does [this solution answer your question?](https://askubuntu.com/a/708262/1222991) – matigo Jun 06 '21 at 14:53
  • @matigo Yes. Absolutely. I posted this question on Reddit and got the same result. It worked out exactly the way I wanted. Thank you for answering. Though The user can turn on airplane mode to turn off the wifi. Otherwise, it works wonderfully. – Arpan Ghosh Jun 07 '21 at 06:47
  • 5
    Does this answer your question? [How do I set the policy for users to modify the network state and connections?](https://askubuntu.com/questions/708261/how-do-i-set-the-policy-for-users-to-modify-the-network-state-and-connections) – Random Person Jun 08 '21 at 14:49

2 Answers2

0

I reached the target with as follow:

sudo mv /usr/bin/gnome-tweaks /usr/bin/gnome-tweaks.real
sudo mv /usr/bin/gnome-control-center /usr/bin/gnome-control-center.real
sudo nano /usr/bin/gnome-tweaks

Added the line

user=$USER ; disp=$DISPLAY ; pkexec sudo -u $user DISPLAY=$disp gnome-tweaks.real

sudo nano /usr/bin/gnome-control-center

Added the line

user=$USER ; disp=$DISPLAY ; pkexec sudo -u $user DISPLAY=$disp gnome-control-center.real

sudo chmod 755 /usr/bin/gnome-tweaks
sudo chmod 755 /usr/bin/gnome-control-center
Pilot6
  • 88,764
  • 91
  • 205
  • 313
dario
  • 16
  • 1
0

To revert back to default settings,

sudo rm /usr/bin/gnome-tweaks
sudo rm /usr/bin/gnome-control-center


sudo mv /usr/bin/gnome-tweaks.real /usr/bin/gnome-tweaks
sudo mv /usr/bin/gnome-control-center.real /usr/bin/gnome-control-center
Subash
  • 66
  • 3