How to include password in shorcut

  • Thread starter Deleted member 151145
  • Start date
D

Deleted member 151145

Guest
I haven't been able to find exactly what I'm looking for anywhere on the 'Net. Maybe I'm just not using the correct terminology for the search.

I know I have done this in the past, but I can't remember how it is done. I want to launch a program via either a Start Menu entry or even a desktop shortcut and NOT be prompted for a password. For instance, I'd like to open Thunar as root and not be prompted for the password. I know several distros include a Start Menu item for opening the file manager, and then another Start Menu item to open the file manager as root. I'm running Mint 20.3 XFCE and there is no listing for opening Thunar as root.

Thanks in advance.
 


Well, that would do it, but that's not what I'm looking for. Somewhere in my past I knew how to create a Menu item or desktop shortcut for one, single program that would launch that program as root by including the password as part of the executable command. I'm only using Thunar as an example, but there is a command that will open Thunar, then there is a different command to open Thunar as root. All I'm looking to do is include the password in the command. Anybody that is running a version of Linux that happens to have a Menu item for their file manage AND a Menu item for their file manager AS ROOT should be able to tell me.

Maybe I'm not making myself really clear. I'm finding that the older I get, the more trouble I have in expressing what it is I'm after. Here is another example. In the Start Menu you can launch the Calculator. That command is "gnome-calculator". If I wanted to open the calculator as root, I can issue this command "sudo gnome-calculator". I have to enter my password for that calculator to open. What I'm trying to do is create a Menu item that launches calculator, as root, WITHOUT having to enter my password. I want to include, or pass, my password in the command. And no, calculator is not the program I'm trying to open. I just used that as an example.

Anybody that has both a Menu item to launch their file manager AND an entry to launch their file manager as root, can look at the command used to launch it as root and tell me how to structure the command.


EDIT: I should not have used "sudo" to open calculator as root. I should have used "pkexec". So, that command would be "pkexec gnome-calculator". I'm just needing to know what else to include in that command when I use it to create a new Menu item that will open calculator as root without asking me for my password.
 
G'day lonewolf, Welcome to Linux.org

I'm finding that the older I get, the more trouble I have in expressing what it is I'm after.
Do not berate yourself....your examples and explanation are perfectly clear.

I will follow this with interest.
 
G'day lonewolf, Welcome to Linux.org


Do not berate yourself....your examples and explanation are perfectly clear.

I will follow this with interest.

Thanks for the welcome. I do sometimes get flustered when I'm just not able to get my point or question across to others. I'm not too big to admit I've started having some trouble with my thought process and my ability to explain a problem or question. I'm up there in age, I have had several serious accidents in my life where I had head trauma, I take a small boat load of prescription pills three times a day, I am a cancer survivor, and I have an untreatable/incurable heart condition. I'm sure I ramble on at times and I'm not always sure I'm saying, or typing, what I'm thinking.

But, as to the question I'm asking here, somewhere in my past I know I was able to do what I want to do. I just can not recall how to do it. I can't turn up what I'm looking for with searches on here or on the 'Net. It CAN be done. I just can't remember how it's done. My next step will be to download a whole covey of different distros trying to find one that has the File Manager As Root option in the Menu. Once I find that, all I need to do is take a look at the entry using a Menu Editor. Yeah, I know. I can find that via the command line. I'm just too tired to do that anymore. It's so much easier to just use a Menu Editor like MenuLibre or AlaCarte, especially when all I need to do is take a peek at the command used to launch an entry.

If I happen to run across a solution, I'll be sure to post it up here.
.
 
.
By the way, Condobloke. I see you also run Mint. I have run it for several years. I'm still stuck on 20.3 because I tried installing 21 on one of my laptops and I never did get things running correctly. I can't think there is that much difference between 20.3 and 21, but I sure fought trying to get it installed. I finally gave up and put 20.3 back on that laptop. Maybe my Lenovo laptops are the culprit, preventing me from getting a successful install done. I suppose it's possible. These things are all 4 or 5 years old now. I'm a firm believer in buying 2 or 3 year old laptops and installing Linux on them. That beats paying $750 to $1,000 for a new one with Windows on it.

Also, I'm asking for advice on here because I got into it with several guys on the Mint forum over this exact question. I made it know what program I'm trying to get running without having to enter a password, and three or four of them jumped all over me, telling me what an idiot I am for using that program. I tried 4 times to tell them that if they didn't have anything useful to add to the thread, to stay the hell off it. I then got a really nasty warning from one of the admins and he and I got into it. He took the other guys' side. I finally told him where to stick it and had my account deleted. Maybe it's just me, but if I don't have something useful to add to somebody else's thread, I just stay away and don't post anything. I for sure never told anybody they were an idiot for using a particular program. I have no idea what others do with the computers. How would I know if a program was useful to them or not? I might suggest an alternative, but if the OP says he wants or needs that specific program, I try and help him get it running, if I can.
.
 
I'm up there in age
You are a welcome addition to the "up there in age" membership of this site, in that case

A few links for you to peruse:


I have not read/watched either of these, so they may be pie in the sky.... but still worth a look.
 
Maybe a starting point:

 
.
OK, Condobloke. The two instructions you offered are only to tell how to set a custom action in Thunar and to create a Taskbar launcher to open Thunar in root mode. This version of Mint XFCE already has that custom action in Thunar and the other simply tells you how to create a launcher that will open Thunar in root mode. The problem is that both of those are basically elaborations for issuing the command, "pkexec thunar". Both still prompt for the password just like using the run box or a terminal to issue the command. I'm seeking a way to launch a program as root, but with no prompt for a password. I keep falling back to a phrase I have been using to search that doesn't give me a solution. I keep wanting to say I need to "pass the password" along with the executable command, but I don't know why I keep thinking that.

KGIII, I'm either not following the directions closely enough, or not changing all the terms to make that work on Mint XFCE, or it's just not compatible with Mint XFCE. Somewhere along the line I managed to Bork my install and couldn't even get Thunar to open. I finally tried doing a complete reinstall of Thunar from within Synaptic and upon a reboot Thunar is back, thankfully. Like an idiot, I'm experimenting on the Lenovo laptop that is MINE. LOL!

I am still downloading and running various other distros, looking for one that has both a File Manager Menu entry as well as a File Manager As Root, Menu entry. As soon as I find one I should be able to use a menu editor to see what the correct command is to launch that particular file manager as root, without a password prompt. Then, all I'll have to do is substitute my program's name for whatever file manager that distro is using. I'm not sure what else to try so off I go again to boot up yet another distro. LOL!
.

 
.
Yeah, that will work, but by creating a situation where a password is NEVER required a fellow sets up a really good way to Bork a system. I am constantly tweaking and trying different things. If I am never asked for a password, I know darned well I'll mange to totally screw up my install. If I understand correctly, Firefox is the best reason to not run with no password required. I read a thread earlier today about doing this and there was a really BIG warning about doing it and then surfing with Firefox. I'll admit that I don't know enough about the inner workings of Linux to try tinkering like that.

I know one thing for sure. I'm done for the day. I've sat right here for the last 9 plus hours and all I've accomplished is giving myself a huge headache. I think I'll just let things lie for a day and see if anybody else knows how to do it. I'm still looking for anybody on the forum that runs a distro that has both a File Manager Menu entry and a File Manager As Root Menu entry. That person, or persons, should be able to take a look at the command used to open the file manager as root and tell me what that command is. I should then be able to just change things to my program and have a working entry.
.
 
G'day @lonewolf and welcome to linux.org :)

I'm up there in age,...

How up there? I am 65 and Brian @Condobloke will be 7x next year, but we have one bloke here, name of Charlie just turned 88 a few weeks ago.

Don't answer here (off topic), but when this Thread is done, or before, get your bum over to Member Introductions and tell us a little of the lonewolf story. We're a pretty friendly bunch.

I am going to move this to Command Line for now, where scripting inquiries are also handled.

There, the Ghost Who Walks aka Jas @JasKinasis may have some ideas. We have a wonderful think tank here, so you can expect to hear from some more folk.

Cheers

Chris Turner
wizardfromoz
 
.
OK, sports fans, we're getting closer. Now I need somebody that knows how to create scripts, or at least that's what I think I need. I have managed to figure out how to launch the program, as root, without being prompted for a password from a terminal, but when I try and create a launcher or a desktop shortcut, it fails. That's why I think I need a script, but I know next to nothing about writing a script. I'll explain why in my New Member Introduction I'm going to write in a few minutes.

For now, this will launch my program from a terminal, as root, without being prompted for a password. Where do I go from here?

echo mypassword | sudo -S myprogram


So, to launch Thunar as root it would look like this;

echo mypassword | sudo -S thunar

.
 
.
OK, guys. I'm going to disclose the actual program I'm trying to launch without being prompted for a password. I deliberately withheld this info, choosing to wait and see what the membership here is like. When I posted what I was trying to do on the Linux Mint forum, I was told "only an idiot would do something so stupid to his own computer" and quite a few told me that Bleachbit would totally Bork any computer is is on. I asked those guys to refrain from posting on my thread if they didn't have anything useful to add. That got me a warning form an admin. I told the admin I didn't appreciate being called an idiot. Things escalated and I ended up with my account being deleted. No kidding.

Anyway, I use Bleachbit on all of my laptops. I have used it for ten years. In all of those years, on all the different computers and all the different distros I ran, I NEVER once Borked a system, NEVER. I found that it keeps things cleaned up a bit. I also use either Ubuntu Cleaner of Stacer occasionally. In fact, this laptop I'm on has Bleachbit and Ubuntu Cleaner on it.

So, I want to be able to launch Bleachbit (as root), without being prompted for a password. I know it can be done,because I did it in the past. I just don't remember how I did it. It's driving me nuts. Whether it's Bleachbit, Thunar, or any other program, there is a way to pass the password along with the command so the program opens as root. I think the answer has to do with the command I posted in my last post, above and I think I have to have a script that includes that command, but I don't know here to go from here.

Any help will be greatly appreciated!
.
 
Huh... Bleachbit will ruin your system! (If you don't use it properly. It's actually quite safe if you follow good practices.)

Rest assured, we don't care if you wanna use Bleachbit - though we would caution new users and suggest a healthy backup schedule.

Now, when I installed it from the default repositories, it shows both Bleachbit and Bleachbit (as root). It does that by default. I did nothing special to have it do that. So, we've got that going for us...

I'd head to /usr/share/applications and open "BleachBit (as root)" with a text editor.

I'd then look to see where it called the file and try echoing the password with that section.

It'd be one of the two following lines, I think:

Code:
TryExec=pkexec
Exec=pkexec bleachbit
 
Bleachbit. I used to have that installed. Until I seriously screwed whatever I had installed at the time. I then had no other option other than to reinstall.....I had no Timeshift set up at that time.

To be clear.....this was not the fault of bleachbit. It was my fault. Failing to understand how to use the thing properly.
That was quite some time ago.
I no longer use it. I have discovered I do not need it to "clean". Linux does it for me, because Linux is not windows.
That's another topic.

@KGIII 's suggestion above shows some promise !
 
.
Yep. Bleachbit does, in fact, install two entries in the Menu just like you said. The fact is that I can easily continue on doing things the way I have been and entering my password to run as root. Except now, it has gotten hold of me and I am bound and determined to figure out how to launch it as root with no password prompt. It's kind of like simply being able to once again do something I was able to do a few years ago.

I'll take a look at that file later this evening and see what it looks like. I'm really stumped at being able to launch it with no password prompt from within a terminal, but can't get a taskbar launcher or desktop shortcut to work.

I'll try and remember to post up what I find in that file.
.
 
I did try a few things with the above and got nowhere.

Then, it disappeared from the application menu - even though I restored it to default. (Always backup first, or at least ensure you can use CTRL + Z to 'undo' your changes!

So, even though it's back exactly as it was, it's missing from the application menu. I suspect it'll restore itself when I log out and log back in again, but I haven't done that.
 
Bleachbit. I used to have that installed. Until I seriously screwed whatever I had installed at the time. I then had no other option other than to reinstall.....I had no Timeshift set up at that time.

To be clear.....this was not the fault of bleachbit. It was my fault. Failing to understand how to use the thing properly.
That was quite some time ago.
I no longer use it. I have discovered I do not need it to "clean". Linux does it for me, because Linux is not windows.
That's another topic.

@KGIII 's suggestion above shows some promise !

You're 100% correct. Linux does a wonderful job of cleaning itself. I'm not really sure why I ever started using Bleachbit, but I'm thinking I got an email from some website I visited that announced a new progrma called, Bleachbit. I'm EXTREMELY careful in what I do and do not allow Bleachbit to do. Yes, if used improperly it can cause some trouble. And to be clear, I have managed to Bork a whole bunch of installs over the years, but every time it was something dumb I did. I do use Timeshift. I don't allow auto backups. I always take the first snapshot as soon as I get that particular install all tweaked and have all the stuff I want installed, and all the stuff I don't want removed. I keep that snapshot forever, or at least until I intentionally do a new install for some reason. I then take additional snapshots right before I try installing something I've never done before. I then always have two snapshots saved on the second drive partition, one beong the original and the other being whatever the last one was. I delete the previous one to save space.
.
 
Here is me talking out of my ear.....probably

Is there any 'joy' to be had by playing around in "users and groups"

Just a wild thought from the blue
 

Members online


Top