LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux Mint
User Name
Password
Linux Mint This forum is for the discussion of Linux Mint.

Notices


Reply
  Search this Thread
Old 01-02-2019, 11:14 AM   #16
guyx
LQ Newbie
 
Registered: Jan 2019
Posts: 2

Rep: Reputation: Disabled

I realised I was repeating your original post to a considerable extent - I felt it might be useful to add weight that multiple users are suffering this issue.

But also you said in an earlier post :-

It makes sense that a script run from a launcher won't work if there is a read command (or a sudo command that requests a password via a read command), since there is no terminal from which to display a message and/or read a response. So the real question is why it worked before?

In the case of sudo, I'm speculating that it did NOT prompt for a password when run from a desktop launcher, but now it does. Alternately, because sudo retains the password for a small time frame, perhaps coincidentally I ran sudo (and entered a valid password) from a terminal, and then ran the desktop launcher script within the time frame?

I felt it might be useful to document my experience which is that sudo works perfectly and prompts for a password from inside a bash script invoked via a desktop launcher on Mint 19 and 17.3. It also works (and prompts) if the launcher itself invokes the entire script inside a sudo call. But neither case works with Mint 19.1.
 
Old 01-02-2019, 11:17 AM   #17
cdgoldin
LQ Newbie
 
Registered: Aug 2018
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
you need to use pkexec instead of sudo (not together).
Do you even bother to read what has been posted? You keep suggesting things that have nothing to do with the problem. pkexec allows an authorized user to execute a program as another user. sudo grants a user root privileges so that the user can execute programs or scripts that require the permission of the root. My scripts (and those of others) need to execute certain commands as root. They do not need to run the entire script as root. pkexec is NOT a solution to the problem.
 
Old 01-02-2019, 11:22 AM   #18
cdgoldin
LQ Newbie
 
Registered: Aug 2018
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by guyx View Post
I realised I was repeating your original post to a considerable extent - I felt it might be useful to add weight that multiple users are suffering this issue.
Yes, you are correct. Thank you.

Quote:
I felt it might be useful to document my experience which is that sudo works perfectly and prompts for a password from inside a bash script invoked via a desktop launcher on Mint 19 and 17.3. It also works (and prompts) if the launcher itself invokes the entire script inside a sudo call. But neither case works with Mint 19.1.
That is useful. So, apparently sudo could prompt for a password without a terminal in earlier versions of Mint, but this capability has been removed in 19.1. Isn't progress wonderful?
 
Old 01-02-2019, 11:31 AM   #19
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,830

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
https://elementaryos.stackexchange.c...re-than-pkexec
https://easylinuxtipsproject.blogspo...bout-root.html
 
Old 01-02-2019, 11:34 AM   #20
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,830

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
Quote:
Originally Posted by cdgoldin View Post
Do you even bother to read what has been posted? You keep suggesting things that have nothing to do with the problem. pkexec allows an authorized user to execute a program as another user. sudo grants a user root privileges so that the user can execute programs or scripts that require the permission of the root. My scripts (and those of others) need to execute certain commands as root. They do not need to run the entire script as root. pkexec is NOT a solution to the problem.
You need to realize, the two things are exactly the same:
Code:
allows an authorized user to execute a program (like a script) as another user (for example as root).
grants a user root privileges so that the user can execute programs or scripts that require the permission of the root.
 
Old 01-02-2019, 11:50 AM   #21
cdgoldin
LQ Newbie
 
Registered: Aug 2018
Posts: 19

Original Poster
Rep: Reputation: Disabled
Rather than launching the script with pkexec, I tried replacing every occurrence of "sudo" in the script with "pkexec", and launching it with bash. Now, the script does prompt for a password (when the first pkexec is encountered), but if the wrong password is supplied, or "cancel" is clicked, it proceeds as if a valid password was provided. Conversely, when the correct password is provided, it prompts for the password every time a pkexec command is issued, rather than only the first time. This is unacceptable, and is NOT "exactly the same" as sudo.

Last edited by cdgoldin; 01-02-2019 at 12:04 PM.
 
Old 01-02-2019, 12:00 PM   #22
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,830

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
Quote:
Originally Posted by cdgoldin View Post
If that were true, they would do exactly the same thing, which they do not.
No, they are definitely not the same. As I posted pkexec is more secure. Especially in case of GUI.

And you still did not explain why can't you just simply [try to] replace sudo (all occurrences in your scripts. One by one). What is the problem with this approach?
 
Old 01-02-2019, 12:08 PM   #23
cdgoldin
LQ Newbie
 
Registered: Aug 2018
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
No, they are definitely not the same. As I posted pkexec is more secure. Especially in case of GUI.
You also posted "they are exactly the same", which is that to which I replied.

Quote:
And you still did not explain why can't you just simply [try to] replace sudo (all occurrences in your scripts. One by one). What is the problem with this approach?
Well, firstly, because when you suggested using pkexec, we were discussing LAUNCHING the program with gksu, so it certainly seemed you were suggesting LAUNCHING it with pkexec instead. And, secondly, as stated in my revised comment above, pkexec does NOT provide the same functionality as sudo, at least without extensive changes to profiles and scripts.
 
Old 01-02-2019, 12:24 PM   #24
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,830

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
Quote:
Originally Posted by cdgoldin View Post
You also posted "they are exactly the same", which is that to which I replied.
I can't find that. But probably misunderstood something. pkexec is the replacement, the more secure version of sudo.

Quote:
Originally Posted by cdgoldin View Post
Well, firstly, because when you suggested using pkexec, we were discussing LAUNCHING the program with gksu, so it certainly seemed you were suggesting LAUNCHING it with pkexec instead.
That is unfortunately what you assumed, I never told "launching with pkexec".
Quote:
Originally Posted by cdgoldin View Post
And, secondly, as stated in my revised comment above, pkexec does NOT provide the same functionality as sudo, at least without extensive changes to profiles and scripts.
I don't think so. You can use the common commands with pkexec "as usual" (instead of sudo), but that is what you need to test.
 
Old 01-08-2019, 07:51 AM   #25
shoka555
LQ Newbie
 
Registered: Jan 2019
Location: Manchester UK
Distribution: Mint and Raspebian
Posts: 1

Rep: Reputation: Disabled
Works for me...

Using the recommended syntax for running command under gnome-terminal works for me on Mint 19.1.

That is terminate the command to start gnome-terminal with "--" (no quotes) and follow with the the command you want executed.

No need for run in terminal, and sudo prompts for a password in the opened terminal.

thus command:

/usr/bin/gnome-terminal -- ssh admin@172.31 etc

functions as I expect.

Harry
 
Old 01-08-2019, 02:07 PM   #26
cdgoldin
LQ Newbie
 
Registered: Aug 2018
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
I can't find that."
On 01-02-19 @ 12:34 PM post #20, you wrote, "You need to realize, the two things are exactly the same:" How difficult was that to find?

Quote:
But probably misunderstood something. pkexec is the replacement, the more secure version of sudo.
Yes, you have apparently misunderstood the problem reported in the first post, and everything since. Whether or not pkexec is more secure is debatable, and it certainly does NOT provide the same functionality as sudo.

Quote:
That is unfortunately what you assumed, I never told "launching with pkexec".
Since we were discussing _launching_ with gksudo, and you suggested "use pkexec instead of sudo", it was the only logical assumption that we were still talking about launching.

Quote:
I don't think so. You can use the common commands with pkexec "as usual" (instead of sudo), but that is what you need to test.
What is the so that you don't think? I have described in detail several differences between pkexec and sudo that make it unsuitable for the application, and NOT a viable replacement. Why do you argue with facts?
 
Old 01-08-2019, 02:15 PM   #27
cdgoldin
LQ Newbie
 
Registered: Aug 2018
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by shoka555 View Post
Using the recommended syntax for running command under gnome-terminal works for me on Mint 19.1....
Perhaps you can explain how it works for you with a more detailed example, because I have no idea how you are using the command.

In my situation, I have a script which invokes sudo several times to perform commands with elevated privileges. The first instance of sudo asked for a password. The subsequent ones do not. This no longer works when launched from the desktop in Mint 19.1. If I launch it with gksudo (gksudo <pathtoscript>), it works as before, but then the entire script is running with elevated privileges, not just the commands prefixed with sudo, which is undesirable (although not critical if there are no errors in the script).

Is your "works for me" situation similar to that described, or are we comparing apples with oranges? If the former, please provide the exact syntax of gnome-terminal that "works for you". And, are you launching a script with gnome-terminal, or are you replacing the sudo commands with gnome-terminal?

Thank you.
 
Old 06-22-2019, 11:16 PM   #28
ZenosKalos
LQ Newbie
 
Registered: Jun 2019
Posts: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by cdgoldin View Post
So the real question is why it worked before?
I would say that the real question is why it stopped working.

If you edit the .desktop file for one of your launchers that used to open a terminal you will see a line that reads:

Terminal=true

If you don't need to see a terminal, obviously, you would set it to false. So the question becomes, was this deprecated?
 
Old 12-15-2019, 04:37 PM   #29
KenUnix
LQ Newbie
 
Registered: Dec 2019
Location: Pennsylvania
Distribution: linuxubuntu
Posts: 28

Rep: Reputation: 6
Try setting the Exec path directly in your desktop file

Workaround I found calling mate-terminal directly from the launcher

Exec=mate-terminal -- path/do/your/script

You can edit your desktop file with vi. This issue had me going in circles for some time.

If you don't have mate installed you can do
sudo apt install mate-terminal

Then once installed start it and click on Edit then Profile Preferences to
set the parameters like font, colors, bell, cursor, etc.

Only certain versions of Linux require this. Ubuntu does not.

Hope this helps...

Update. It appears in Mint 19.2 it got fixed. Try a sudo apt update and
sudo apt upgrade then edit Exec in your desktop file. Be sure the mode
of your script file is 755. So it looks executable.

Exec=/path/do/your/script

Seems it works as expected.

Last edited by KenUnix; 12-17-2019 at 06:27 PM. Reason: Typo
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How do I find the target of a desktop launcher? How do I edit an existing launcher? tnandy Linux - Software 9 01-23-2018 09:25 PM
[SOLVED] firefox launcher doesn't show icon on panel bar of slackware but launcher still there mshlinux Linux - Newbie 6 04-24-2013 10:56 PM
Launcher Problems! Why is there a line through my icons on my launcher? LinuxNoob12 Linux - Newbie 1 10-26-2012 01:37 AM
LXer: Move unity launcher to the bottom with Unity Bottom Launcher | PPA Ubuntu LXer Syndicated Linux News 0 12-19-2011 12:30 AM
Creating a launcher (could be java launcher) The_Messiah Linux - Newbie 12 04-06-2005 01:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux Mint

All times are GMT -5. The time now is 03:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration