Execute on USB insert (Italiano)

From ArchWiki
Revision as of 11:41, 9 January 2011 by Veleno77 (talk | contribs)
Jump to: navigation, search

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.

Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어

External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Tango-preferences-desktop-locale.pngThis article or section needs to be translated.Tango-preferences-desktop-locale.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Execute on USB insert (Italiano)#)
Nota: Questo articolo è in fase di traduzione. Seguite per ora le istruzioni della versione inglese.

Suppose you want to execute a certain program on the insertion of a usb dongle. Personally, I added this feature because I was getting frustrated with the computer locking up and all keyboard and mouse input was lost (The sysrq keys were not working).

There is an added security feature so that only dongles with the correct key can run the program.


Put a copy of the [[Execute_on_usb_insert#exdongle_script|Template:Filename script]] (given below) in your path.

Add the following line to your udev USB mount rule (Modify to fit your configuration):

 ACTION=="add", RUN+="/usr/bin/exdongle run /media/%k-%E{dir_name}"

Run the configuration option, for example


This sets the configuration to a random key value (only programs with the correct keys can be run on the computer), and the runtime priority to -10.

Setting up a USB dongle

First, write a script that you want to run when the dongle is inserted.

For example:


Now run the new option:

 exdongle new <Dongle mount point> test.sh

Now, whenever you insert the dongle, a root shell will be opened under the X server running on display :0. This may be useful for some administrative purposes.


There may be security issues with this, and it is probably best used only on a personal computer.

exdongle script



Some notes:

  • The programs/scripts used should be self contained, the only file treated is the one passed.