How to make gnomesu command shorter?

In other distro/DE they have ‘kdesu’ ‘sudo’ ‘gksu’ (or whatever else) that basically allows a command to be executed temporarily with root privilege.

But in Gnome (at least Gnome 3 in openSUSE) it is ‘gnomesu’ and I find 7 letters are annoyingly too long. gnomesu this gnomesu that. Too long.

is there any shorter command? or way to make it shorter?

(other than su)

ln -s /usr/bin/gnomesu /usr/bin/hurpderp

Ooh its that simple actually. thanks.

so I rename it to ‘up’. Will it possibly conflict with any other existing important application (that i might install later)?

Create a file .alias in your home directory and put a line like

alias g='gmomesu'

in it.

But I realy wonder how many times a day you are usuing this. Running things as root must be an exception in a normal stable system.

If you want to create an alias or create a link (soft/hard) of an executable or even a function, you should consider that the name you want to use is already existing in your PATH or the alias/function is already define.

check for the aliases in your system

alias

check for the functions in your system.

set

check for an executable is in your PATH,

type -a «command»

«command» can be ls,grep or any other command/executable you use.

help type 

for more info.

The common mistake is create an alias, function, executable that is named test since it is a shell builtin according to

type -a test

If you want to know which get executed first, the PATH executable or the builtin see.

man bash

and look for COMMAND EXECUTION.

On Tue, 30 Sep 2014 19:16:01 +0000, razirazo wrote:

> Ooh its that simple actually. thanks.
>
> so I rename it to ‘up’. Will it possibly conflict with any other
> existing important application (that i might install later)?

Possibly, it would be impossible to enumerate every possible executable
you /might/ install and whether or not any given name you choose to use
is going to conflict with it.

Try it and see.

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

I would prefer:


ln -s /usr/bin/gnomesu $HOME/bin/hurpderp

That way, the alternative name is available only to me, and won’t confuse all of the other users of the system (all zero of them, as it happens). It seems better to make such changes local rather than global.

On 2014-09-30 21:16, razirazo wrote:
>
> Ooh its that simple actually. thanks.
>
> so I rename it to ‘up’. Will it possibly conflict with any other
> existing important application (that i might install later)?

Open a terminal, type “up”, then press tab twice. Then enter “su -”, give password, and repeat the
procedure.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” (Elessar))

On 2014-09-30 20:26, Miuku wrote:
>
> ln -s /usr/bin/gnomesu /usr/bin/hurpderp

Let’s improve it a bit :slight_smile:

Make it:


ln -s /usr/bin/gnomesu /usr/local/bin/hurpderp

Because it does not interfere with the system automatics (meaning: package udates/upgrades, easier
maintenance, etc).

If you wish to do it for a single user, then instead do:


ln -s /usr/bin/gnomesu ~/bin/hurpderp

Where the “~” stands for your home directory, so you don’t need to type it.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” (Elessar))

On 2014-09-30 21:16, hcvv wrote:

> But I realy wonder how many times a day you are usuing this. Running
> things as root must be an exception in a normal stable system.

For that reason, what I do is open a terminal, and enter “su -”, and leave it there… as I
hibernate every day, it stays opens for weeks.

Sometimes, from that xterm I open other xterms, which thus run as root as well. Sometimes I can have
dozens of them. It is easier than starting several xterms and typing the password on each one.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” (Elessar))

I concur to your conclusion. But specialy because it is not true that there are zero other users on he system. There more then twenty of them (look in /etc/passwd) and some of them (specialy root) are used for running prcocesses (deamons or other). So changing/adding names that may be used by those users (specialy when they are executables found in the PATH of such users) can be harmfull.

On 2014-10-01 13:56, hcvv wrote:

> I concur to your conclusion. But specialy because it is not true that
> there are zero other users on he system. There more then twenty of them
> (look in /etc/passwd) and some of them (specialy root) are used for
> running prcocesses (deamons or other). So changing/adding names that may
> be used by those users (specialy when they are executables found in the
> PATH of such users) can be harmfull.

Good point.

And that reminds me, that “/usr/local/bin/” is not always in the path, specially for root.
Also, there are many scripts that specify the full path to whatever they call.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” (Elessar))

It should never be in root’s PATH. Same for any other “system” user.

And btw this is one of the security issues when you use

su

instead of

su -

Wrong PATH (and maybe intervening aliases, and …)

On 10/01/2014 08:18 AM, Carlos E. R. wrote:
> On 2014-10-01 13:56, hcvv wrote:
>
>> I concur to your conclusion. But specialy because it is not true that
>> there are zero other users on he system. There more then twenty of them
>> (look in /etc/passwd) and some of them (specialy root) are used for
>> running prcocesses (deamons or other). So changing/adding names that may
>> be used by those users (specialy when they are executables found in the
>> PATH of such users) can be harmfull.
>
> Good point.
>
>
> And that reminds me, that “/usr/local/bin/” is not always in the path,
> specially for root.
> Also, there are many scripts that specify the full path to whatever they
> call.
>

Which is why using a local .alias file is the best approach to creating
your own “shortcut” commands.

Ken

On 2014-10-01 14:46, hcvv wrote:
>
> robin_listas;2667371 Wrote:
>>
>> And that reminds me, that “/usr/local/bin/” is not always in the path,
>> specially for root.
>>
> It should never be in root’s PATH. Same for any other “system” user.

Well, it is where programs I build locally go to, and I need them.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” (Elessar))

/usr/local/bin is in the PATH for system wide users including root ( at least in my system it is :slight_smile: )

It is where local scripts/binary/executable that sysadmins/users and not for packages AFAIK, kinda like /etc/systemd for local purposes and /usr/libsystemd/system for packages ( i hope :wink: )

On 2014-10-02 00:06, jetchisel wrote:

> /usr/local/bin is in the PATH for system wide users including root ( at
> least in my system it is :slight_smile: )
>
> It is where local scripts/binary/executable that sysadmins/users and not
> for packages AFAIK, kinda like /etc/systemd for local purposes and
> /usr/libsystemd/system for packages ( i hope :wink: )

Not users: only the sysadmin can install there. :slight_smile:

Thus, if you build, say, “bash” locally, without creating an rpm, and
install it, it goes to /usr/local by default. All users would run that
version instead of the distribution version. Root would still run the
distribution version - because of the ordering of path for both.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

Oh wow. thanks people!
I learn lots of things I never have a thought before from every post you made. :slight_smile:

Im deploying lots of PC for some proof-of-concept project spanning several computer lab; where there are multiple type of PC with different configurations that I need to install one by one before full deployment from disk image.

Sounds more like something to be done from the CLI, on the real console and no login in the GUI at all. But this comment is only made without knowing any details about what you are doing.

My original remark was based on my own experiences (with can of course differ widely from your’s) and on using KDE. I use YaST from the KDE menu as important tool for actions to be done as root (thus no kdesu (the KDE equivalent of gomesu), just clicking. And for CLI actions I use Terminal in Superuser Mode (or similar wording, it starts Konsole with an su -) from the KDE menu. Again only click.

Apart for the fact that I use the CLI for checking/testing actions to post here when answering people, I do not use it very much. About the same for YaST. In a system that is in production, I will do YaST about once a week for updating software. So even when I had to use gnomesu, it wouldn’d be worth for me to make an alias.