LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Trying to get sudo to work in a .desktop icon command, under SUSE 10.1 (https://www.linuxquestions.org/questions/linux-software-2/trying-to-get-sudo-to-work-in-a-desktop-icon-command-under-suse-10-1-a-467154/)

DeekBeek 07-24-2006 12:00 PM

Trying to get sudo to work in a .desktop icon command, under SUSE 10.1
 
Allright, things have been changed with the sudo program in SUSE 10.1. Does anybody out there want to give me the short version? I've consulted man visudo, man sudoers, and I'm not getting very far. I'm thinking that there's an additional text file to edit, somewhere.
I had the Netzero dialer installed under SUSE 10.0 so that I could run it with the following Command line in the .desktop file:
Code:

sudo /opt/nzclient/runclient.sh
The above, of course, did not work without the following change in the sudoers file, made with visudo (and checked with visudo -c afterwards), in the User privilege specification section of the file:

Code:

deekbeek          ALL=NOPASSWD: /opt/nzclient/runclient.sh
"deekbeek", you understand, stands for my actual username, which is in lowercase, also (maybe after today, "deekbeek" should be my real name).
In spite of all this preparation, I can't run the Netzero dialer as anything but root, anymore; I could run it under sudo as a regular user in SUSE 10.0 with the preparations cited.
On the light side, any Linspire users can't brag about the Netzero dialer being theirs. Use alien to change netzero.deb to an rpm, install it with the new right-click software installer (forget Yast), change permissions for read, write and execute in the nzclient folder (and all subfolders), and there you have it. It's still for (GROAN) root only use in that state, though.

spirit receiver 07-24-2006 01:10 PM

I'd say that line in /etc/sudoers looks all right. What happens if you invoke the sudo command from the console?

DeekBeek 07-24-2006 01:47 PM

If I enter this in my user Konsole:
Code:

sudo /opt/nzclient/runclient.sh
the system gives back the message:
Code:

DM set to off
:scratch:

spirit receiver 07-24-2006 02:36 PM

I have no idea what that means, but at least there seems to be nothing wrong with the sudo part.
You say it works fine as root, so there must be something wrong with the environment. What does the following give?
Code:

sudo su - -c /opt/nzclient/runclient.sh

DeekBeek 07-24-2006 05:50 PM

That's just a typist way of doing what I already do with GUI, the system asks for a root password (I didn't bother typing the password to see if it would connect).

DeekBeek 07-26-2006 11:43 AM

I've visited /usr/share/doc/packages/sudo on my drive, and read the troubleshooting doc and then tried this in the Defaults section of the sudoers file:
Code:

Defaults always_set_home
Defaults env_reset
Defaults:deekbeek runas_default=/opt/nzclient/runclient.sh

The above was an add-on to the user privilege specification section containing:
Code:

deekbeek            ALL=NOPASSWD: /opt/nzclient/runclient.sh
It still doesn't work, I still can't start Netzero with the .desktop file(the Netzero icon) as user deekbeek, having the following under properties, application tab, command:
Code:

su /opt/nzclient/runclient.sh
the system still demands a root password, which means I'm still running netzero as root in spite of the changes. I don't know what gives. I also removed the two lines in the Defaults section that the first-installed sudoers file warns you to remove (doesn't help). I even commented out (used a #) on my other user privilege section line and tried:
Code:

deekbeek  ALL=(ALL) ALL
This does not help! I've thoroughly checked with visudo -c for sudoers corruption. I'd of had this problem solved in SUSE 10.0, by yesterday, maybe an hour after the first time I'd encountered it!

berbae 07-26-2006 12:04 PM

To launch a program with sudo you must use:
sudo /opt/nzclient/runclient.sh
not
su /opt/nzclient/runclient.sh
as you seem to have under properties/application tab/command of the .desktop file
so replace su with sudo and it should work well with
deekbeek ALL=NOPASSWD: /opt/nzclient/runclient.sh
in the sudoers file
Don't use
deekbeek ALL=(ALL) ALL
for security reason.

DeekBeek 07-26-2006 01:29 PM

Thanks for spotting my typo. However, trying sudo instead of su again, which I already did with all of the conditions above, yesterday (and just tried it all again before my reply) using:
Code:

sudo /opt/nzclient/runclient.sh
in the command line of the application tab of the icon, still does not work. Using su was a typo on my part only today, in the posting. I tried sudo with everything, in the .desktop file command line, all over again to be sure. It doesn't work. I'm stuck using the arrangement as root and the stuff will not run as a different user (i.e., deekbeek). I only had to change one line in sudoers, and one in the .desktop file, when running SUSE 10.0 (I already hate 10.1):cry:

DeekBeek 07-28-2006 07:38 AM

Apologies to those to whose time I have wasted with typographical errors. I am compelled to re-summarize my unresolved problem (side-stepping the overshadowing problem that SUSE 10.1 has a bad on-line updater zenworks/Yast fiasco, and I can't add a crypt partition or use encfs, etc.):

I have been able to run Netzero, which defaults it's installation to use by the root user only, as a non-root user, without being prompted to enter a password. I have been able to take this for granted and able to continuously do it with SUSE Linux versions 9.2 and 10.0. The actual program is the Netzero dialer (installed from an .rpm made by the alien program, out of the downloaded netzero.deb file). The circumstances which have allowed me to do this included editing the sudoers file, and then entering sudo (which I typographically mixed up with su, earlier, but I did not insert it as an actual syntax error in my trials; I checked this) at the start of the command line in the command box, under the application tab, produced by the properties pull-down of the netzero.desktop file(i.e., the icon).
Now that I have SUSE Linux 10.1 installed, I can no longer accomplish this. I tried placing the following line in the user privilege specification section of the sudoers file:

Code:

deekbeek            ALL=NOPASSWD: /opt/nzclient/runclient.sh
That line was paired with this following line in the command box under the application tab of the properties pull-down of the netzero.desktop file icon:

Code:

sudo /opt/nzclient/runclient.sh

The changes above will not run Netzero (logged in as the user deekbeek under SUSE 10.1) from a click on the Netzero icon, and those changes only always did run Netzero under SUSE 10.0 or 9.2 (again, as the non-root user deekbeek). I can only run this as root now, with root typed into the run as a different user box under the activated check box, under advanced options of the application tab, under the properties pull-down of the netzero.desktop icon. I also always have to enter the root password in a popup prompt, presently.
I am including the full contents of my present sudoers file in the code section below; can anybody tell me exactly which lines to change and where, so that I may return to running Netzero as a non-root user? You will notice commented-out lines which I have also tried (in the defaults and user privilege specification section), due to having already consulted the troubleshooting document in /usr/share/doc/packages/sudo. I have always run the visudo -c command after edits, to ensure a non-corrupt sudoers file :

Code:

# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#

# Host alias specification

# User alias specification

# Cmnd alias specification

# Defaults specification

# prevent environment variables from influencing programs in an
# unexpected or harmful way (CVE-2005-2959, CVE-2005-4158,
# CVE-2006-0151)
Defaults always_set_home
Defaults env_reset
# Defaults:deekbeek runas_default=/opt/nzclient/runclient.sh
# In the default (unconfigured) configuration, sudo asks for the root password.
# This allows use of an ordinary user account for administration of a freshly
# installed system. When configuring sudo, delete the two
# following lines:



# Runas alias specification


# User privilege specification
root    ALL=(ALL) ALL
# deekbeek            ALL=NOPASSWD: /opt/nzclient/runclient.sh

# Uncomment to allow people in group wheel to run all commands
# %wheel        ALL=(ALL)      ALL

# Same thing without a password
# %wheel        ALL=(ALL)      NOPASSWD: ALL

# Samples
# %users  ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
# %users  localhost=/sbin/shutdown -h now
                                                              39,1          Bot


berbae 07-28-2006 08:35 AM

Does the sudo command work with another script/program to run as root?
Try to put in the sudoers file:
Quote:

deekbeek ALL=NOPASSWD: some/other/program/or/script
and run in a console under deekbeek login:
Quote:

sudo some/other/program/or/script
Look in /var/log/messages if there are errors.
Also check if you have a /var/run/sudo directory which is owned by root with permissions drwx------

DeekBeek 07-31-2006 01:12 PM

I think it's time to look for another ISP, then. I lack a similar external program package installed in a similar-enough way to consider trying to run it with sudoers and sudo (as a test). I have error messages logged, about sudo failing to run, which I expect. The permissions are as you state.
I don't have time for this, because I cannot apply any update patches in SUSE 10.1.

DeekBeek 08-12-2006 08:17 PM

Here it is, then. I signed up with allvantage.com today. It works easily enough run as a regular user from kinternet, but I can't figure out a kppp setup, yet (I'd like that better, since it can store all the access numbers on my Desktop).


All times are GMT -5. The time now is 08:59 AM.