Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #228132 > unrolled thread
| Started by | Bob Bernstein <poobah@ruptured-duck.com> |
|---|---|
| First post | 2020-10-23 04:40 +0200 |
| Last post | 2020-10-23 14:20 +0200 |
| Articles | 12 — 7 participants |
Back to article view | Back to linux.debian.user
PATH nfg after su Bob Bernstein <poobah@ruptured-duck.com> - 2020-10-23 04:40 +0200
Re: PATH nfg after su Bob Bernstein <poobah@ruptured-duck.com> - 2020-10-23 05:50 +0200
Re: PATH nfg after su Greg Wooledge <wooledg@eeg.ccf.org> - 2020-10-23 14:10 +0200
Re: PATH nfg after su Greg Wooledge <wooledg@eeg.ccf.org> - 2020-10-23 14:20 +0200
Re: PATH nfg after su Tixy <tixy@yxit.co.uk> - 2020-10-23 14:40 +0200
Re: PATH nfg after su Greg Wooledge <wooledg@eeg.ccf.org> - 2020-10-23 14:40 +0200
Re: PATH nfg after su Sven Hartge <sven@svenhartge.de> - 2020-10-23 15:20 +0200
Re: PATH nfg after su Tixy <tixy@yxit.co.uk> - 2020-10-23 20:00 +0200
Re: PATH nfg after su Dan Ritter <dsr@randomstring.org> - 2020-10-23 20:10 +0200
Re: PATH nfg after su "Andrew M.A. Cater" <amacater@einval.com> - 2020-10-24 21:20 +0200
Re: PATH nfg after su <tomas@tuxteam.de> - 2020-10-24 21:40 +0200
Re: PATH nfg after su "Andrew M.A. Cater" <amacater@einval.com> - 2020-10-23 14:20 +0200
| From | Bob Bernstein <poobah@ruptured-duck.com> |
|---|---|
| Date | 2020-10-23 04:40 +0200 |
| Subject | PATH nfg after su |
| Message-ID | <B2V9L-1Tq-7@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | Bob Bernstein <poobah@ruptured-duck.com> |
|---|---|
| Date | 2020-10-23 05:50 +0200 |
| Message-ID | <B2Wfv-2uZ-3@gated-at.bofh.it> |
| In reply to | #228132 |
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
[toc] | [prev] | [next] | [standalone]
| From | Greg Wooledge <wooledg@eeg.ccf.org> |
|---|---|
| Date | 2020-10-23 14:10 +0200 |
| Message-ID | <B343n-7jM-9@gated-at.bofh.it> |
| In reply to | #228135 |
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
[toc] | [prev] | [next] | [standalone]
| From | Greg Wooledge <wooledg@eeg.ccf.org> |
|---|---|
| Date | 2020-10-23 14:20 +0200 |
| Message-ID | <B34d4-7mX-7@gated-at.bofh.it> |
| In reply to | #228135 |
On Fri, Oct 23, 2020 at 12:15:24PM +0000, 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*.
[toc] | [prev] | [next] | [standalone]
| From | Tixy <tixy@yxit.co.uk> |
|---|---|
| Date | 2020-10-23 14:40 +0200 |
| Message-ID | <B34wq-7t7-13@gated-at.bofh.it> |
| In reply to | #228140 |
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).
[toc] | [prev] | [next] | [standalone]
| From | Greg Wooledge <wooledg@eeg.ccf.org> |
|---|---|
| Date | 2020-10-23 14:40 +0200 |
| Message-ID | <B34wq-7t7-25@gated-at.bofh.it> |
| In reply to | #228142 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Sven Hartge <sven@svenhartge.de> |
|---|---|
| Date | 2020-10-23 15:20 +0200 |
| Message-ID | <B3597-7V6-13@gated-at.bofh.it> |
| In reply to | #228142 |
Tixy <tixy@yxit.co.uk> 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.
[toc] | [prev] | [next] | [standalone]
| From | Tixy <tixy@yxit.co.uk> |
|---|---|
| Date | 2020-10-23 20:00 +0200 |
| Message-ID | <B39w6-1Tx-5@gated-at.bofh.it> |
| In reply to | #228146 |
On Fri, 2020-10-23 at 15:11 +0200, Sven Hartge wrote: > Tixy <tixy@yxit.co.uk> 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
[toc] | [prev] | [next] | [standalone]
| From | Dan Ritter <dsr@randomstring.org> |
|---|---|
| Date | 2020-10-23 20:10 +0200 |
| Message-ID | <B39FL-2cR-3@gated-at.bofh.it> |
| In reply to | #228149 |
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-
[toc] | [prev] | [next] | [standalone]
| From | "Andrew M.A. Cater" <amacater@einval.com> |
|---|---|
| Date | 2020-10-24 21:20 +0200 |
| Message-ID | <B3xf3-7V0-3@gated-at.bofh.it> |
| In reply to | #228149 |
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 <tixy@yxit.co.uk> 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
[toc] | [prev] | [next] | [standalone]
| From | <tomas@tuxteam.de> |
|---|---|
| Date | 2020-10-24 21:40 +0200 |
| Message-ID | <B3xyp-81g-7@gated-at.bofh.it> |
| In reply to | #228168 |
[Multipart message — attachments visible in raw view] — view raw
On Sat, Oct 24, 2020 at 07:12:20PM +0000, 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
[toc] | [prev] | [next] | [standalone]
| From | "Andrew M.A. Cater" <amacater@einval.com> |
|---|---|
| Date | 2020-10-23 14:20 +0200 |
| Message-ID | <B34d4-7mX-9@gated-at.bofh.it> |
| In reply to | #228135 |
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 >
[toc] | [prev] | [standalone]
Back to top | Article view | linux.debian.user
csiph-web