How to give permissions to devices

Many a time you face with this challenge that as a user you do not have permission to read write a device file in Linux without becoming sudoer.

Example: Let us say you have a USB device say a camera or any other device file let us say /dev/uinput the file for multi touch.
You want to read write these files in your program.

You can only run this program with sudo as the device files will not be accessible otherwise.

There is a workaround to make these files read/writable once and for all by doing something like:

sudo chmod 777 /dev/uinput

But You need to do above on each restart and also not a great way to handle this problem.

There is an easy way by creating rules file inside /etc/udev/rules.d.
For example:

# DVP sensor driver rule

KERNEL=="video0", SUBSYSTEM=="video4linux", ATTRS{name}=="vfe_0", GROUP="video", MODE:="766"


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s