Jump to content

find The current directory is included in the PATH environment variable

Recommended Posts

I'm trying to use find and run a execdir on .rar files for mass unpacking but i'm getting the error that . is in the $path. Should'nt that be removed?


"find: The current directory is included in the PATH environment variable, which is insecure in combination with the -execdir action of find.  Please remove the current directory from your $PATH (that is, remove "." or leading or trailing colons)"



Edited by Tuumke
Link to comment
  • 1 year later...
  • 2 years later...

Sorry to resurrect an old thread... but to anyone coming across this problem in future, here is an easy solve applying a little beginner linux knowledge;


# Take a backup of $PATH to restore later
# Note: This will only keep the variable alive for the current session!

# ... just to make sure the $PATH_TEMP variable has been stored
$ echo $PATH_TEMP

# Print the current $PATH so we can extract all paths except the current directory, so we can override it
$ echo $PATH
# Copy everything BUT the first current directory marker (.) and break character (:)

# Next, export the modified $PATH to override it for the current session using the string you copied above
$ export PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin

# ... just to make sure the $PATH variable change has been stored
$ echo $PATH

# ---
# ... now you can run the find command!
# ---

# To restore the session $PATH either close your current terminal session and start a new one, or to manually restore
# the current session, lets load $PATH back from the $PATH_TEMP variable set earlier
$ export PATH=$PATH_TEMP

# ... verify everything is back to normal. Looking good!
$ echo $PATH


Edited by unraidyn
  • Thanks 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...