Is using the following kinds of pathnames in $PATH
a secure and good practice:
empty pathname.
findutils manual says it is insecure if
$PATH
contains an empty pathname, and I wonder why?Is an empty pathname an absolute or relative pathname?
pathnames containing tilde or filename expansions.
Can a user of
$PATH
always understand and perform tilde or filename expansions in$PATH
like shell?If I set the value of
PATH
in a shell startup script such as~/.profile
, does it matter at all, given that a shell executes the startup file?I found one related to tilde expansion https://unix.stackexchange.com/a/154290/674
current working directory. See Is it safe to add . to my PATH? How come?
Thanks.
.
is insecure no matter where inPATH
it appears. People make typos all the time. The classic example is a malicious executable in/tmp
calledsl
. – Reid Jun 07 '18 at 19:32$PATH
? – Tim Jun 07 '18 at 19:53grpe
– Chris Davies Jun 07 '18 at 20:23