🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.folklore.computers
Article #623820

Re: First use of /sbin in Unix?

#623820
From: Jorgen Grahn
Date: Sat, 09 Jun 2018 09:18
99 lines
5709 bytes
On Thu, 2018-06-07, Grant Taylor wrote:
> On 06/07/2018 06:18 AM, Jorgen Grahn wrote:
>> seems to me overriding a standard utility would almost always be the 
>> wrong solution to a problem.
>
> Maybe, maybe not.
>
> Keep in mind, I'm only superseding / augmenting system commands that I 
> want to run differently than they do by default.
>
> I have ~/bin first in my path.  I have a number of utilities that 
> require root permission (gained via sudo) that I run ALL THE TIME (as in 
> daily, some many times a day).
>
> So I have a wrapper [1] that I put in ~/bin for things like ip, netstat, 
> ifconfig, route, etc so that I can type commands into my unprivileged 
> user's shell exactly the same way that I would type them in root's shell.

Most of those don't need root privileges for reading (although some
Linux distributions annoyingly put them in /sbin and don't put /sbin
in $PATH for normal users).  I think it's useful to have them
available and to know you cannot break anything unless you
specifically choose to.

> I don't have to worry about needing to prefix commands with sudo (et al) 
> or not.
> I don't have to worry about using different formats of commands in 
> different contexts.
> I don't have to worry about escaping special characters to make it 
> through sudo.
> Etc.

I'd worry about scripts picking up the wrong copy of ip, netstat and
friends, and run stuff as root (and log a sudo use) when they really
just want read access.

> I personally consider removing all the above mental load and making the 
> computer do what I want to be a good thing.  Thus I consider it to be 
> the proper solution.

My time to stick my neck out:

I don't like sudo.  I'd much rather su to root in a separate shell,
and carefully do my privileged work there, then log out when I'm done.
I don't want dangerous command lines to end up in my shell history,
where I can by accident execute them again and (if I ran sudo
recently) have them execute without warning.

Sudo blurs the distinction between me and the root user, it seems to
me.

That way I also don't have to understand the sudo config files.

> There is also the fact that I have a LOT of commands in ~/bin that don't 
> exist anywhere else that I use hourly (while at the computer).  So 
> having them in a directory that is last in the PATH means that the shell 
> has to traverse more directories to find them.
>
> Aside:  I use a lot of extremely small shell scripts instead of aliases 
> because I want to also be able to use the same shell scripts from within 
> other locations where aliases don't apply, like non-interactive ssh 
> remote command execution or other shell scripts.

I was going to mention aliases as an alternative, but that's a valid point.
Aliases are a bit ... unorthogonal.

> What if I want a specific version of a command later in the PATH 
> priority that gets superseded by a different version that is earlier in 
> the PATH priority?  Having ~/bin first in the PATH allows me to make a 
> sym-link to the version that I want.  Thus the version that I want is 
> found and supersedes the version I want to avoid.

Yes.  I haven't encountered any "false twins" like that in recent
decades, though.  Debian Linux (and probably others) has the
/etc/alternatives system for when e.g. you have two different vi
clones installed; I use that one.

/etc/alternatives is system-global though, so if I was on a multi-user
system where the sysadmin declared that Vim is the right vi and I
wanted nvi instead, I might consider doing what you do.

> Finally, remember that we're talking about a user's PATH, not the system 
> wide PATH.  Which means (to me) that it's up to the given user to 
> configure things the way that they want.  Far be it for me to tell you 
> what you should and should not do.

Same here, of course!  Whatever I write in this thread has a bunch of
"IMHO" and "YMMV" attached to it.

I found it interesting to read about how you structure your environment.

/Jorgen

> [1] Link - Sudify
>       - https://dotfiles.tnetconsulting.net/tools/sudify/sudify.html

-- 
  // Jorgen Grahn <grahn@  Oo  o.   .     .
\X/     snipabacken.se>   O  o   .
Technical Details
Message-ID: <slrnphn6rh.31ka.grahn+nntp@frailea.sa.invalid>
Path: mbox-mo1.pugleaf.net!n13-v6ni9592wmc.0!nntp.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
References: <pf6emc$3h2$1@dont-email.me> <ZzzRC.190248$T14.113297@fx44.iad> <pf7ieq$40p$1@tncsrv09.home.tnetconsulting.net> <20180606103538.7eddd3774f5429f1abd54fc6@eircom.net> <XnsA8F990C4CB379admin127001@85.214.115.223> <pf8vvb$oko$1@tncsrv09.home.tnetconsulting.net> <slrnphgdv7.31ka.grahn+nntp@frailea.sa.invalid> <sfXRC.288871$yc1.96733@fx40.iad> <slrnphi8k3.31ka.grahn+nntp@frailea.sa.invalid> <pfbuep$lb$1@tncsrv09.home.tnetconsulting.net>

Show Full Headers
Complete Article Headers
X-Received: by 2002:a1c:7a11:: with SMTP id v17-v6mr768174wmc.28.1528535923494;        Sat, 09 Jun 2018 02:18:43 -0700 (PDT)
X-BeenThere: alt.folklore.computers@googlegroups.com
Received: by 2002:a1c:f117:: with SMTP id p23-v6ls706233wmh.4.canary-gmail; Sat, 09 Jun 2018 02:18:42 -0700 (PDT)
X-Received: by 2002:a1c:7c12:: with SMTP id x18-v6mr860836wmc.5.1528535922708;        Sat, 09 Jun 2018 02:18:42 -0700 (PDT)
MIME-Version: 1.0
Path: mbox-mo1.pugleaf.net!n13-v6ni9592wmc.0!nntp.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: Jorgen Grahn <grahn...@snipabacken.se>
Newsgroups: alt.folklore.computers
Subject: Re: First use of /sbin in Unix?
Date: 9 Jun 2018 09:18:41 GMT
Lines: 99
Message-ID: <slrnphn6rh.31ka.grahn+nntp@frailea.sa.invalid>
References: <pf6emc$3h2$1@dont-email.me> <ZzzRC.190248$T14.113297@fx44.iad> <pf7ieq$40p$1@tncsrv09.home.tnetconsulting.net> <20180606103538.7eddd3774f5429f1abd54fc6@eircom.net> <XnsA8F990C4CB379admin127001@85.214.115.223> <pf8vvb$oko$1@tncsrv09.home.tnetconsulting.net> <slrnphgdv7.31ka.grahn+nntp@frailea.sa.invalid> <sfXRC.288871$yc1.96733@fx40.iad> <slrnphi8k3.31ka.grahn+nntp@frailea.sa.invalid> <pfbuep$lb$1@tncsrv09.home.tnetconsulting.net>
X-Trace: individual.net orDlI/cSmM1LfCRCsIbVZA/SZxSQySuq6Q++r88ohCwOipWEch
Cancel-Lock: sha1:w05ns0JH6emhCRtfOMdviP4q57U=
User-Agent: slrn/1.0.2 (OpenBSD)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit