help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: prob , PATH inheritage | early modment , sudo , wsl deb


From: Kerin Millar
Subject: Re: prob , PATH inheritage | early modment , sudo , wsl deb
Date: Sat, 10 Feb 2024 12:35:09 +0000

On Sat, 10 Feb 2024 04:04:55 +0100
alex xmb sw ratchev <fxmbsw7@gmail.com> wrote:

> i have :
> wsl debian , starting that windows app brings up terminal and normal user
> is logged in
> 
> i wanna do :
> auto login to root , and have the from-user /mnt/c/*windows* PATHs
> 
> i did :
> a login bashrc / profile that saves the extra paths to a var
> and have /root/*somebashrc* add that to PATH
> cause i couldnt make it neither inherit nor early-add , to PATH , BASH_ENV
> nor --init-file worked
> 
> my cmdline :
> sudo HOME=/root sps="${PATH#*:/bin:}" bash -l < optional args bad code >
> 
> ? why only rc file in /root fix this problem ?
> 
> i had tried and failed :
> a_code = printf %s\\n 'PATH+=:$sps'
> sudo BASH_ENV=<( a_code ) bash -l
> sudo bash --init-file <( a_code ) -l
> sudo bash --init-file /dev/fd/3 3< <( a_code )

LESS=+/closefrom man sudoers

Press 'n' until you land on the description of closefrom, which states the 
following:

"Before it executes a command, sudo will close all open file descriptors other 
than standard input, standard output, and standard error (file descriptors 
0-2)."

-- 
Kerin Millar



reply via email to

[Prev in Thread] Current Thread [Next in Thread]