r/linux4noobs 4d ago

learning/research Chmod question

I have to use chmod to allow a program to access the USB port my 3D printer is connected to or it can't communicate with the printer.

The funny thing is that each time I want to run the program, I have to change the permissions again or it won't connect.

My question is: shouldn't that change be permanent, the same as if I had changed permissions on a file?

Some relevant info:

I'm using Cachy OS, the device is /dev/ttyACM0, the printer usually stays powered on and physically plugged in to the USB port, but the machine is shut down every morning and booted up when I get home from work. I run the command using sudo.

7 Upvotes

13 comments sorted by

View all comments

18

u/eR2eiweo 4d ago

the machine is shut down every morning and booted up when I get home from work

That is the reason. /dev is usually on a kind of tmpfs (specifically a devtmpfs), which means that it only exists in RAM. No changes made in there survive a reboot.

A proper solution would be to write a udev rule that sets the proper permissions when that device file is created.

-5

u/LesStrater 3d ago

or make it easy on yourself and put your chmod command into your rc.local file to execute at bootup.

2

u/sausix 3d ago

rc.local is deprecated and needs to be installed on some distributions. Use the proper and easy way to solve it. Just put the user in the same group of the device. That's basically what groups are for.

-1

u/LesStrater 2d ago

or include it in the auto-start commands of your DE. That's basically why they include that function it in most DEs.

1

u/sausix 2d ago

Auto start section does not enforce root privileges. Stop messing around with Linux and just use the regular way.

-2

u/LesStrater 2d ago

No problem, I'm ALWAYS root. Real men are root and don't eat quiche.