You are not logged in.
Hi,
I'm running arch + plasma (just plasma, not the full kde) + Dolphin + Kate + Konsole + some other apps. I just found Gnome's text editor, gedit, seems to be a better editor for me than Kate. Is it possible to make gedit ask for root authentication when necessary just like Kate does?
A related question: Dolphin is the kde file manager but it lacks the root authentication function that Kate has. Is there a tip to enable this? Is there any other file manager that has this function? I think it's a nice-to-have if I can copy files into "/etc" etc. without having to going to a terminal.
Thanks a lot
Last edited by learnarch (2020-09-23 08:35:56)
Offline
The root authentication option for Dolphin is in the works afaik but not currently possible (FWIW I just enable the embedded terminal in dolphin, then you still have a quick way of doing moves/renames as root without going into the implications/complexity of exposing dolphin to a root account). As for other file managers --- and incidentally gedit, all the things using GNOME/gvfs for their file access should be able to use the admin:// protocol. So if you intend to open a file with root access in gedit, you should be able to use
gedit admin://$pathtofileto get gedit to give you the relevant prompt.
Offline
The root authentication option for Dolphin is in the works afaik but not currently possible (FWIW I just enable the embedded terminal in dolphin, then you still have a quick way of doing moves/renames as root without going into the implications/complexity of exposing dolphin to a root account). As for other file managers --- and incidentally gedit, all the things using GNOME/gvfs for their file access should be able to use the admin:// protocol. So if you intend to open a file with root access in gedit, you should be able to use
gedit admin://$pathtofileto get gedit to give you the relevant prompt.
Thanks a lot for your reply. Regarding Kate, I justed tested in Konsole and it worked. But it asked for the root password before opening the file, rather than when trying to saved the file like Kate does. So it does not seem to be a proper replacement of Kate as the default editor. First, in most cases, I just need to view those system files with no intention to edit. So entering the password is unnecessary. Second, for files in my home directory, even to edit, I shouldn't have to give a password. I guess there's no way to set up the system so that when I click a file in Dolphin, it's smart enough to dynamically determine whether to use the admin:// protocol to call gedit depending on the file permission.
Thx
Offline
[ -w "$1" ] && exec gedit "$1"
exec gedit "admin://$1"If you want it to deal w/ "can I write this new file?" the checks will get a bit more complicated (man test; man dirname)
Offline
[ -w "$1" ] && exec gedit "$1" exec gedit "admin://$1"If you want it to deal w/ "can I write this new file?" the checks will get a bit more complicated (man test; man dirname)
Thanks a lot for your reply. Trying to understand your reply made me learn more Linux basics:)
I created a shell script "dedit" with exactly the two lines you gave, not even adding the shebang line. It worked as expected in Konsole. But I'm wondering, when $1 is a file for which I have enough permissions, why the script CORRECTLY stops when I exit gedit, without going on to execute the second line.
And I have trouble with setting "dedit" as the default text editor. I use Plasma, so in System Settings->Applications->File Associations->Known Types->text->plain->Application Preference Order, I added dedit at the top. In the Application tab of the settings of dedit, the Command is: /home/me/dedit. When I click a txt file in Dolphin, a popup error message says: Unknown error code 100; execvp: Exec format error. When I tick the "Run in terminal" checkbox in Advanced Options in the Application tab of dedit, the error message in Konsole is: Warning: Could not start program '/home/me/dedit' with arguments '/home/me/dedit /home/me/t1.txt'. Any idea?
Thx
Offline
To make the script executable you should also add a shebang at the top.
#!/usr/bin/bashOffline
To make the script executable you should also add a shebang at the top.
#!/usr/bin/bash
Yes thanks a lot. Now I know the shebang line can only be omitted if the script is called within a terminal.
Do you know why the second exec in the script is not executed when the first one is executed?
Thx
Offline
Do you know why the second exec in the script is not executed when the first one is executed?
Thx
If you
man execyou will see that exec never returns, it replaces the shell that called it
Offline
learnarch wrote:Do you know why the second exec in the script is not executed when the first one is executed?
ThxIf you
man execyou will see that exec never returns, it replaces the shell that called it
Strange, "man exec" shows "No manual entry for exec". But I can "man" other topics like test/dirname. Anyway, your answer makes sense to me.
Thanks a lot.
Offline
The exec manpage is provided by the "man-pages" package (test/dirname -also- by "coreutils")
Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.
Offline
Strange, "man exec" shows "No manual entry for exec".
For Shell builtin commands you can use --help.
$ exec --helpLast edited by solskog (2020-09-23 07:45:03)
Offline
Thanks everyone.
Offline