Posted  01 May 2010 - 18:01:44

Category: Linux

sudo actions has different path than the user

You might notice that when you perform an action with the sudo method, your PATH is different than your user's.

Put this in your ~/.bashrc:

alias sudo='sudo env PATH=$PATH'

1 comment:

5/18/2016 5:47:14 PM  Ben  wrote:

This works well for something like the following: >> sudo which pip In that case, it finds the location of the function "pip" in the path of my normal user rather than the path that sudo defaults to. However, it breaks functionality of the following statement: >> sudo -i The result is the following: env: -i No such file or directory

© SolutionCottage 2008-2011 9/23/2017 11:52:44 AM