Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 602  / 1 Year ago, thu, january 5, 2023, 9:15:02

I have used gksu -w shutdown -hP now as a system-wide menu command in icewm, so that when a non-admin user clicked the shutdown from the menu, a password dialogue box will appear asking for the admin password. That was when I was running icewm in Linux Mint.



When I switched to Ubuntu, the same command wouldn't work. Although the same dialogue box asking for admin password appears, but none of the existing sudoers password I tried would work or accepted. Even the password of the first account I was asked to make on installation of Ubuntu wouldn't work.



I have also tried gksu -u admin-user -w 'shutdown -hP now, but the error message "shutdown: Need to be root" came up.



So what is the difference between Ubuntu's and Mint's gksu rules? I'm currently using Ubuntu 12.04 LTS, and the Mint I'm referring to is Mint 13 Maya. And what could be other alternative ways to allow a Shutdown command in the IceWM menu for non-admin users, but I still want them to ask permission first from me before they could shutdown, by asking for my admin password?



Besides shutdown, I also have other commands in the IceWM menu that require admin privileges, like hibernate, to mount a backup partition, and synaptic, which I applied gksu -w with.


More From » permissions

 Answers
2

The problem:




  • gksu -w will ask for your root password, however the root user does not have a password by default in Ubuntu, so everything you try will fail.


  • gksu -u admin-user -w will execute shutdown as admin-user, but you need to be root, not admin-user.




The possible solutions are two:




  1. Use gksu -u admin-user -w gksu -S. Which means: first switch to admin-user (gksu -u admin-user -w), then become root (gksu -S).


  2. Set a password for the root user. This way, gksu -w will work as you expect.




The drawback for the first solution is that you will be asked for two passwords, which may be uncomfortable. The drawback for the second solution is that enabling the root user is not recommended.


[#29781] Saturday, January 7, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
elopingapo

Total Points: 206
Total Questions: 110
Total Answers: 114

Location: Guam
Member since Tue, Nov 29, 2022
1 Year ago
elopingapo questions
Fri, Sep 10, 21, 17:52, 3 Years ago
Tue, May 24, 22, 00:42, 2 Years ago
Sat, Apr 23, 22, 03:16, 2 Years ago
Fri, Jan 13, 23, 06:41, 1 Year ago
;