I am programming a (web based) POS system, dedicated to be running on a debian based ITX-server with apache2 etc. Currently I am using Lubuntu 14.04 LTS for development (and for the 1st customer) with no login on boot up. To open the cash drawer programatically independent from a receipt printer, I am using a small chinese :-) USB-to-serial adapter, which I am speaking with using these commands:

sudo chmod 777 /dev/ttyUSB0


echo -en '1' > /dev/ttyUSB0

which works great, and on the FIRST try. Trial and NO error !

Since I experienced, that it doesn't work anymore after next reboot, until I set the chmod again, I added the local user to sudoers and granted him /bin/chmod with NOPASSWD, and put the chmod command in rc.local

Good so far. Now it works seamless after each boot or reboot.

NOW the question: What I need to do, to get the same result later, when the debian webserver will have no GUI and runs without login ? Whom is to be granted the chmod command, and where should I put the chmod command, if not in rc.local ?

Thanks for answer(s).


I think there are cleaner solutions to your problem: add your user to a dialout group or use udev to automatically chmod fresh device.

They are discussed here: https://askubuntu.com/questions/112568/how-do-i-allow-a-non-default-user-to-use-serial-device-ttyusb0

  • Thanks for your answer, Sergey. There would be different ways to grant anything to a user or group, but... May be that I didn't point out enough, what's my problem: I need to perform a task, which needs root or sudo privilegues, WITHOUT anybody is logged in. Let's say as a service like samba or apache or whatever. Debian runs in a black box without keyboard nor screen. – ddlab Feb 2 '15 at 19:40
  • Ah, wait moment :-) You said udev... I went into it on ubunti-wiki... this sounds good. Will play around with it. Thanks for now. – ddlab Feb 2 '15 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.