On Sat, Aug 26, 2023 at 06:42:42PM -0400, Karl Vogel wrote:
> If you're running bash, the safest way to find your current working
> directory is capturing the output from /bin/pwd. Symlinked directories
> can surprise you:
>
> me$ cd
>
> me$ ls -ldF today
> lrwxr-xr-x 1 me mis 18
On Sat, Aug 26, 2023 at 12:09:57PM -0400, Tom Browder wrote:
> Excellent mind-reading, Greg! So to use your line I will put in that dir:
> "cd /required-dir || exit"
>
> Thanks so much. And thanks to all others who responded.
If you're running bash, the safest way to find your current workin
On Sat, Aug 26, 2023 at 01:54:41PM -0500, Tom Browder wrote:
> On Sat, Aug 26, 2023 at 10:42 wrote:
[...]
> > Basically it is not possible to find out [...]
> As I think I replied earier, I am now checking the script is in the
> required directory in order to be executed (by the root user) [...
On Sat, Aug 26, 2023 at 10:42 wrote:
> On Sat, Aug 26, 2023 at 04:45:54PM +0200, DdB wrote:
> > Am 26.08.2023 um 16:25 schrieb Tom Browder:
> > > Is there a way to distinguish whether 'sudo -i' was used or not?
> > >
> > Sorry, i am not an expert on this. But ... since years i am using this
> > t
* On 2023 26 Aug 11:10 -0500, Tom Browder wrote:
> On Sat, Aug 26, 2023 at 10:57 Greg Wooledge wrote:
>
> > On Sat, Aug 26, 2023 at 10:49:45AM -0500, Tom Browder wrote:
> > > I would like to know whether 'sudo -i' or 'sudo -s' was used.
>
> ...
>
> > In fact, I suspect "I need to know if the cw
On Sat, Aug 26, 2023 at 11:56:27AM -0400, Greg Wooledge wrote:
> On Sat, Aug 26, 2023 at 10:49:45AM -0500, Tom Browder wrote:
> > I would like to know whether 'sudo -i' or 'sudo -s' was used.
>
> That's STILL an X-Y problem.
>
> > The reason is
> > to know if the cwd is set to '/root' or '.' It's
On 26 Aug 2023 11:56 -0400, from g...@wooledge.org (Greg Wooledge):
> You don't actually need to know what was typed.
And even being able to answer the question "how was sudo executed"
doesn't solve the problem of ensuring that the script is executing
within a particular directory. All it takes is
On Sat, Aug 26, 2023 at 10:57 Greg Wooledge wrote:
> On Sat, Aug 26, 2023 at 10:49:45AM -0500, Tom Browder wrote:
> > I would like to know whether 'sudo -i' or 'sudo -s' was used.
...
> In fact, I suspect "I need to know if the cwd is /root" is STILL an X-Y
> problem. It's sounding like "I nee
On Sat, Aug 26, 2023 at 10:49:45AM -0500, Tom Browder wrote:
> I would like to know whether 'sudo -i' or 'sudo -s' was used.
That's STILL an X-Y problem.
> The reason is
> to know if the cwd is set to '/root' or '.' It's critical for the script
> execution
Oh? Then just look at the current work
On Sat, Aug 26, 2023 at 09:32 Roberto C. Sánchez wrote:
> On Sat, Aug 26, 2023 at 09:25:10AM -0500, Tom Browder wrote:
> >In a previous thread it was shown how to detect a SUDO_USER in a bash
> >shell.
> >Is there a way to distinguish whether 'sudo -i' was used or not?
I would like
On Sat, Aug 26, 2023 at 04:45:54PM +0200, DdB wrote:
> Am 26.08.2023 um 16:25 schrieb Tom Browder:
> > Is there a way to distinguish whether 'sudo -i' was used or not?
> >
> Sorry, i am not an expert on this. But ... since years i am using this
> to check for it:
>
> > # if `echo $HOME` is not "/
On Sat, Aug 26, 2023 at 09:25:10AM -0500, Tom Browder wrote:
> In a previous thread it was shown how to detect a SUDO_USER in a bash shell.
>
> Is there a way to distinguish whether 'sudo -i' was used or not?
I have not tested this but if bash was interactive you will find a
.bash_history file in
Am 26.08.2023 um 16:25 schrieb Tom Browder:
> Is there a way to distinguish whether 'sudo -i' was used or not?
>
Sorry, i am not an expert on this. But ... since years i am using this
to check for it:
> # if `echo $HOME` is not "/root" or the working dir (pwd) is not "/root",
> then this was not
On Sat, Aug 26, 2023 at 09:25:10AM -0500, Tom Browder wrote:
>In a previous thread it was shown how to detect a SUDO_USER in a bash
>shell.
>Is there a way to distinguish whether 'sudo -i' was used or not?
>Thanks.
>-Tom
The SUDO_COMMAND environment variable would report /bin/b
In a previous thread it was shown how to detect a SUDO_USER in a bash shell.
Is there a way to distinguish whether 'sudo -i' was used or not?
Thanks.
-Tom
15 matches
Mail list logo