Hi, Le 02/08/2024, Greg Wooledge <g...@wooledge.org> a écrit:
> I don't use zsh, so I don't quite understand what "compinit" means. It is a Zsh function that initializes completion for the current session. From zshall(1): Use of compinit (...) To initialize the system, the function compinit (...) should be autoloaded (...), and then run simply as `compinit'. This will define a few utility functions, arrange for all the necessary shell functions to be autoloaded, and will then re-define all widgets that do completion to use the new system. > But, just looking at the su(1) man page: > > -m, -p, --preserve-environment > Preserve the entire environment, i.e., do not set HOME, SHELL, USER > or LOGNAME. This option is ignored if the option --login is > specified. > > The main issue here is likely to be the HOME variable. If you're running > a shell as root, but with HOME=/home/florent or whatever, then some of > the programs you start may create new dot files inside /home/florent/. > These files will be owned by root (because the programs are running as > root). Then, at some point in the future, if you run those same programs > as florent, you won't be able to change the contents of the dot files. > (You would, however, be able to remove them.) (...) Exactly. I was willing to quickly try 'su -p' for the sake of this thread, but not for more than that. [ In the past, I used to just 'su' in order to work as root. This worked fine for a long time, until I had some problems that boiled down to an administrative task (namely, upgrading an emacs package using apt) messing with the home directory of the user invoking 'su'—maybe because of LOGNAME which, after a simple 'su', contains the normal username, not “root”. Since then, I use 'su -' and the problem didn't occur anymore (this doesn't allow one to start graphical apps without already mentioned contortions; for this case, there is 'ssh -X'). ] Thanks for your other (snipped) comments. Regards -- Florent