Linked Questions
21 questions linked to/from How to make `sudo` preserve $PATH?
2
votes
1
answer
6k
views
sudo python3 is running different version than running python3 without sudo [duplicate]
I built and installed python3.8 in raspbian and changed PATH
export PATH=$HOME/.local/bin/:$PATH
I run
>>which python3
/home/pi/.local/bin//python3
>>python3 --version
Python 3.8.0
>&...
1
vote
1
answer
4k
views
Why is my sudo PATH different than my normal user PATH? [duplicate]
I'm having trouble with my PATH. I have a clean instance of an Amazon Linux virtual server and I set this in /etc/profile
M3_HOME=/usr/local/maven
JAVA_HOME=/usr/java/latest
PATH="$PATH:$M3_HOME/bin:...
2
votes
2
answers
1k
views
Have a command in my $PATH, but it is not being recognized when I use sudo [duplicate]
I’m using Ubuntu 14.04. I’m having trouble getting a command picked up in my $PATH using sudo. I have added this to my /root/.profile file
# ~/.profile: executed by Bourne-compatible login shells.
...
1
vote
1
answer
1k
views
Network namespaces and scripts seem to break $PATH [duplicate]
Assume the following script:
$ cat test.sh
#!/bin/bash
echo $PATH
This happens:
$ echo $PATH
/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/<user>/.local/bin:/home/<user>/bin
$ ...
1
vote
0
answers
490
views
svn not found with sudo in front of it [duplicate]
when I want to start svn with sudo, I get this error message
sudo: svn: command not found
I recently compiled the newest subversion on my own and removed the subversion from my RedHat 7 machine. When ...
0
votes
0
answers
356
views
Strange behaviour in CENTOS 7 where binary is not available as root, but is available to user data process [duplicate]
In AWS EC2, I am using Centos 7, I observe strange behaviour where a binary for Hashicorp Vault CLI (/usr/local/bin/vault) is available during boot to commands I run in user data. It is also ...
0
votes
0
answers
34
views
'-bash: line 1: rescanscsi: command not found' error even though script location is in PATH and other script runs fine from same folder [duplicate]
I'm new to linux, trying to switch over from Windows, and I could really use some help. This is actually my first time using a forum such as this so please forgive any errors I make.
I'm using Linux ...
55
votes
7
answers
125k
views
how to pass environment variable to sudo su
I basically need to do this:
DUMMY=dummy
sudo su - ec2-user -c 'echo $DUMMY'
This doesn't work. How can I pass the env variable $DUMMY to su? -p doesn't work with -l.
62
votes
8
answers
69k
views
Why are PATH variables different when running via sudo and su?
On my fedora VM, when running with my user account I have /usr/local/bin in my path:
[justin@justin-fedora12 ~]$ env | grep PATH
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/...
20
votes
3
answers
21k
views
Why is PATH reset in a sudo command? [duplicate]
After much frustrating head-brick-wall contact, I've discovered this:
$ echo $PATH
/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/steve/bin
$ sudo bash
# echo $PATH
/usr/local/...
12
votes
2
answers
19k
views
debian su - and su $PATH differences?
$ su -
Password:
# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# exit
logout
$ su
Password:
# echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
I have ...
18
votes
2
answers
37k
views
Why running command as sudo returns command not found?
Sample command:
drush cc all
works, but this:
sudo drush cc all
gives me:
sudo: drush: command not found
Why? How to fix this?
17
votes
3
answers
64k
views
LD_LIBRARY_PATH always blank after sudo
I get shared library errors whenever I seem to install software manually. Upon executing echo $LD_LIBRARY_PATH it shows up as.. nothing. I've tried adding /usr/local/lib to a .conf file in /etc/ld.so....
3
votes
1
answer
8k
views
Why do the following ways to preserve environment variables for sudo not work? [closed]
From https://stackoverflow.com/a/29400598/156458
The other solutions I've seen here so far are based on some system
definitions, but it's in fact possible to have sudo use the current
PATH (with ...
0
votes
3
answers
2k
views
Some commands appear to be missing unless I use sudo
I am running Debian 10 (upgraded from 9) and I recently noticed that quite a few commands appear to be missing from the system unless they are run with sudo - bash says that they are not found.
$ ...