SOLVED: How can I write a script to do the following ...

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
Pepi
Level 6
Level 6
Posts: 1305
Joined: Wed Nov 18, 2009 7:47 pm

SOLVED: How can I write a script to do the following ...

Post by Pepi »

I have a USB device that will create a hidraw file in /dev when it is attached. after you unplug the device the file is deleted :cry: How can I write a script that I can run after plugging in the device. The hidraw file needs the permissions changed for some reason? I've been doing the below on the command program but I would like to be able to just run a script to do this.
Thanks


cd ../..

cd dev

sudo chmod 777 hidraw*
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: How can I write a script to do the following ...

Post by rene »

You shouldn't write a script as such but a udev rule. Which, mind you, only come across as intimidating. Usually and in this case someone else has already done the work and you only need to place a single-line file somewhere under /etc/udev/rules.d. See first (self-)answer at https://unix.stackexchange.com/question ... ermissions
User avatar
Pepi
Level 6
Level 6
Posts: 1305
Joined: Wed Nov 18, 2009 7:47 pm

Re: How can I write a script to do the following ...

Post by Pepi »

Thank you kind sir :D Worked like a charm.

I added KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0664", GROUP="plugdev" to a file and that's IT :mrgreen:
Locked

Return to “Beginner Questions”