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.

I would like to execute some script automatically when removable media (e.g. USB flash memory) mounted. It likes autoexec.bat on Microsoft Windows.

How can I realize it?

In existing question (and answer), How to run a script when a specific flash-drive is mounted?, It's solution is edit rules.d on local storage.

However, I don't want to edit it. Because my purpose is build installer or log data capture for a lot of target.

On Windows, when removable media (autoexec.bat included) mounted, autoexec.bat start quickly without any settings for system. I would like to do the same things it.

share|improve this question

Your Answer


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

Browse other questions tagged or ask your own question.