Re: PATH nfg after su

2020-10-24 Thread tomas
On Sat, Oct 24, 2020 at 07:12:20PM +, Andrew M.A. Cater wrote:

[...]

> sudo su - has one advantage: it gives you root's path and root's home 
> directory - so you end up in /home/root or wherever root's
> home is set to. Otherwise, you end up, potentially, in the calling user's 
> home directory.

Not with sudo -i. This one runs a login shell for the user
you "sudo" to and puts you in its home directory. More or
less what "su -" does.

Cheers
 - t


signature.asc
Description: Digital signature


Re: PATH nfg after su

2020-10-24 Thread Andrew M.A. Cater
On Fri, Oct 23, 2020 at 06:49:52PM +0100, Tixy wrote:
> On Fri, 2020-10-23 at 15:11 +0200, Sven Hartge wrote:
> > Tixy  wrote:
> > > On Fri, 2020-10-23 at 08:19 -0400, Greg Wooledge wrote
> > > > Using "sudo su -" is a new one to me.  Not only are you
> > > > wastefully
> > > > running two programs when you only need one.
> > > It's useful (essential?) if you want a root shell when there's no
> > > root
> > > password set like on Ubuntu (and optionally on Debian).
> > 
> > No.
> > 
> > "sudo -i" does exactly that: Run a shell as "root" and ask for the
> > password of the user calling it.
> 
> Thanks. Debian has su installed as part of a required package so I
> never bothered installing sudo, it just seemed to be an Ubuntu thing.
> 
> -- 
> Tixy
> 
sudo su - has one advantage: it gives you root's path and root's home directory 
- so you end up in /home/root or wherever root's
home is set to. Otherwise, you end up, potentially, in the calling user's home 
directory.

Just my 0.02c

Andy



Re: PATH nfg after su

2020-10-23 Thread mick crane

On 2020-10-23 19:01, Dan Ritter wrote:


I first used Linux in 1992, 13 or 14 months after Linus started
writing it. sudo was already 12 years old.


"Where do you want to go today" did it for me but I had such a lot of 
trouble shifting head into gear. Never really managed.


--
Key ID4BFEBB31



Re: PATH nfg after su

2020-10-23 Thread Dan Ritter
Tixy wrote: 
> 
> Thanks. Debian has su installed as part of a required package so I
> never bothered installing sudo, it just seemed to be an Ubuntu thing.

Robert Coggeshall and Cliff Spencer wrote the original subsystem
around 1980 at the Department of Computer Science at
SUNY/Buffalo. Robert Coggeshall brought sudo with him to the
University of Colorado Boulder. Between 1986 and 1993, the code
and features were substantially modified by the IT staff of the
University of Colorado Boulder Computer Science Department and
the College of Engineering and Applied Science, including Todd
C. Miller. The current version has been publicly maintained
by OpenBSD developer Todd C. Miller since 1994, and has been
distributed under an ISC-style license since 1999.

I first used Linux in 1992, 13 or 14 months after Linus started
writing it. sudo was already 12 years old.

-dsr-



Re: PATH nfg after su

2020-10-23 Thread Tixy
On Fri, 2020-10-23 at 15:11 +0200, Sven Hartge wrote:
> Tixy  wrote:
> > On Fri, 2020-10-23 at 08:19 -0400, Greg Wooledge wrote
> > > Using "sudo su -" is a new one to me.  Not only are you
> > > wastefully
> > > running two programs when you only need one.
> > It's useful (essential?) if you want a root shell when there's no
> > root
> > password set like on Ubuntu (and optionally on Debian).
> 
> No.
> 
> "sudo -i" does exactly that: Run a shell as "root" and ask for the
> password of the user calling it.

Thanks. Debian has su installed as part of a required package so I
never bothered installing sudo, it just seemed to be an Ubuntu thing.

-- 
Tixy



Re: PATH nfg after su

2020-10-23 Thread Sven Hartge
Tixy  wrote:
> On Fri, 2020-10-23 at 08:19 -0400, Greg Wooledge wrote

>> Using "sudo su -" is a new one to me.  Not only are you wastefully
>> running two programs when you only need one.

> It's useful (essential?) if you want a root shell when there's no root
> password set like on Ubuntu (and optionally on Debian).

No.

"sudo -i" does exactly that: Run a shell as "root" and ask for the
password of the user calling it.

S!

-- 
Sigmentation fault. Core dumped.



Re: PATH nfg after su

2020-10-23 Thread Greg Wooledge
On Fri, Oct 23, 2020 at 01:30:11PM +0100, Tixy wrote:
> On Fri, 2020-10-23 at 08:19 -0400, Greg Wooledge wrote
> [...]
> > Using "sudo su -" is a new one to me.  Not only are you wastefully
> > running two programs when you only need one.
> [...]
> 
> It's useful (essential?) if you want a root shell when there's no root
> password set like on Ubuntu (and optionally on Debian).

"sudo -s" and "sudo -i".

Hell, even "sudo bash" would be better.  su does a ridiculous amount
of extra crap.



Re: PATH nfg after su

2020-10-23 Thread Tixy
On Fri, 2020-10-23 at 08:19 -0400, Greg Wooledge wrote
[...]
> Using "sudo su -" is a new one to me.  Not only are you wastefully
> running two programs when you only need one.
[...]

It's useful (essential?) if you want a root shell when there's no root
password set like on Ubuntu (and optionally on Debian).




Re: PATH nfg after su

2020-10-23 Thread Greg Wooledge
On Fri, Oct 23, 2020 at 12:15:24PM +, Andrew M.A. Cater wrote:
> Behaviour changed in Buster - su - is now required. [Likewise sudo su - if 
> you use sudo]

That's silly.  Just use "sudo -i" if you want a root login shell, or
"sudo -s" if you want a normal root shell (roughly equivalent to what "su"
used to do before buster).

Using both sudo and su chained together is a complete waste.

Using "sudo su -" is a new one to me.  Not only are you wastefully
running two programs when you only need one, but you're ignoring the
fact that sudo has already changed PATH for you, so you don't need to
force su to run a login shell to do it *again*.



Re: PATH nfg after su

2020-10-23 Thread Andrew M.A. Cater
On Thu, Oct 22, 2020 at 11:41:07PM -0400, Bob Bernstein wrote:
> On Thu, 22 Oct 2020, Bob Bernstein wrote:
> 
> > PATH=/home/bob/bin:/usr/local/bin:/usr/bin:/bin:/usr/games
> 
> I examined su(1) and learned that one solution for me is to invoke su with
> the '-l' argument, which creates a 'login' shell in the new env. This sets,
> for me, the PATH to
> '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
> 
> Which is very cool..
> 

Behaviour changed in Buster - su - is now required. [Likewise sudo su - if you 
use sudo]
Catches people out especially because of muscle memory :)

All the best,

Andy Cater


> Thank you.
> 
> -- 
> A person of great honour in Ireland (who was pleased to stoop so low as to
> look into my mind) used to tell me that my mind was like a conjured spirit,
> that would do mischief if I did not give it employment.
>   Jonathan Swift
> 



Re: PATH nfg after su

2020-10-23 Thread Greg Wooledge
On Thu, Oct 22, 2020 at 11:41:07PM -0400, Bob Bernstein wrote:
> On Thu, 22 Oct 2020, Bob Bernstein wrote:
> 
> > PATH=/home/bob/bin:/usr/local/bin:/usr/bin:/bin:/usr/games
> 
> I examined su(1) and learned that one solution for me is to invoke su with
> the '-l' argument, which creates a 'login' shell in the new env. This sets,
> for me, the PATH to
> '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
> 
> Which is very cool..

Not the word I would have chosen.  See also:

https://wiki.debian.org/NewInBuster



Re: PATH nfg after su

2020-10-22 Thread Bob Bernstein

On Thu, 22 Oct 2020, Bob Bernstein wrote:


PATH=/home/bob/bin:/usr/local/bin:/usr/bin:/bin:/usr/games


I examined su(1) and learned that one solution for me is to 
invoke su with the '-l' argument, which creates a 'login' shell 
in the new env. This sets, for me, the PATH to 
'/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'


Which is very cool..

Thank you.

--
A person of great honour in Ireland (who was pleased to stoop so 
low as to look into my mind) used to tell me that my mind was 
like a conjured spirit, that would do mischief if I did not give 
it employment.

  Jonathan Swift



PATH nfg after su

2020-10-22 Thread Bob Bernstein
Here I've been sailing along blissfully unaware that when on 
those rare occasions I execute su in a terminal, say to tweak my 
exim4 config, that I had a pretty much useless PATH in the env 
after su-ing:


PATH=/home/bob/bin:/usr/local/bin:/usr/bin:/bin:/usr/games

So I could not, say, execute 'service exim4 restart'. (But 
systemctl was available because /bin was in PATH.)


The above-mentioned blissful unawareness fostered my delusion 
that 'su' in bash loaded the contents of /etc/profile.


But enough about me. Obviously my login process is hosed 
somewhere, no doubt the result of years of bringing this box 
along to its current buster status.


Thoughts? All suggestions will be much appreciated. (I can even 
accept a bit of abuse if that is required of me.)


Thank you.

--
 A test of right and wrong must be the means, one would
 think, of ascertaining what is right or wrong, and not a
 consequence of having already ascertained it.

  J. S. Mill