On Lu, 15 iul 19, 10:20:34, Greg Wooledge wrote: > > The implementation of su in stretch-and-earlier is the best of all worlds. > You get PATH set correctly before and after, you get to keep all of your > customized environment settings like $PAGER and $LESS, and it doesn't > change your working directory in the middle of your workflow.
It's probably not affecting me because of a different workflow. > What are the replacement choices? > > * "su -" throws away your custom environment AND changes your working > directory. > > * "sudo -i" throws away your custom environment AND changes your working > directory. > > * "sudo -s" throws away most of your custom environment (unless configured > in a non-default way). > > * Putting /usr/local/sbin (et al.) in your regular PATH and using "su" > lets you keep your custom environment and your working directory, at > the cost of inefficiency when you're not root. This may be extremely > difficult with some Display Managers. > > * Putting ALWAYS_SET_PATH yes in /etc/login.defs lets you keep your > customized enviornment and your working directory, without imposing > an extra cost when you're not root. > > Objectively, the last one is the best choice, but I have *just* enough > inertia that I don't really want to do that... so I've settled for sudo -s. > For now, anyway. I reserve the right to change my mind and do something > else if I get sufficiently annoyed. Let me suggest an alternative workflow: * Do everything from a user account, except for the (very few) actions that actually require elevated privileges. Looking up man pages, retrieving package information, check networking info[1], etc. is only ever done from the user account. I switch to root only when I need to do apt update/upgrade/install/etc., edit configuration files, restart daemons/system, etc. This has the nice (for me) side effect that the root environment requires very little (if any) customization[2] as all customizations I really care about are done for my user account. In practice I'm doing this with screen configured to always start a user shell and a root shell (using sudo -i). This also provides me with a consistent environment, regardless if I'm logged in locally or via ssh. [1] iproute2 (i.e. ip and friends) have been a major improvement for my workflow in this regard, in addition to being shorter to type ;) [2] currently the only customization I need for root is 'update-alternatives --config editor', which is useful for the user account as well ;) It also helps that vim in its default configuration has enough advanced features for my use. Kind regards, Andrei -- http://wiki.debian.org/FAQsFromDebianUser
signature.asc
Description: PGP signature