Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Okay, so I have my scripts in ~/bin/, and they are added to the path normally. However, when I prefix them with sudo, they are not in the path. I figure this is because they're not in the path for root which sudo is using.

How can I change it so sudo also looks in my path? Or alternatively, so that my bin is in the root path? Thanks!

share|improve this question
add comment

1 Answer

Open a terminal:

sudo visudo

Edit the line like so (and change wojox to your user):

Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/wojox/bin"
share|improve this answer
    
I removed the extra colon after the user's bin entry in path, as this actually meant that the current working directory was in path as well, and this you do not want. –  user76204 Aug 17 '13 at 17:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.