I have a python program that should automatically change the disc volume names / labels for newly inserted usb mass storage devices - it just uses a system call like fatlabel /dev/sdc1 MyNewLabel
details in
https://github.com/s-light/usbstick_masscopy/blob/master/usbstick.py
currently i getting an open: Permission denied
error. ok - for normal usage that is fine - if i want to change the disc-label i have to use root-privileges.
but i don't like to run my python script with sudo. so is there an other solution to this?
i think it could work in some way if i can create an udev rule that adds these newly attached usb-mass-storage devices to a special group or user that is allowed to change the labeling?!
could this work?
edit: i have found how to execute a command without sudo that points to the capability system there the nearest i have found is 'CAP_SYS_ADMIN' i have tested this with this script but i did not get it to work. (iam getting the permission denied errors..)
for my mounting and un-mounting i have found the pmount and pumount option - this works fine. something similar as replacement for fatlabel
would be my favorite - but till now i did not find something.
i hope you have some advice / tips for me
sunny greetings stefan
adduser <user> disk
or to the group which has write permission to device.