Click here to Skip to main content
11,931,813 members (66,057 online)
Rate this:
Please Sign up or sign in to vote.
See more: C++ Linux Ubuntu GCC
I created one application for Ubuntu that reads data from serial port and save to a file. But when I run the application that wont work. One permission denied Issue. That is working when I run from terminal using sudo ./AppName an type the password after that.

How I can run and work it without using sudo command.

my requirement is to use it as a daemon by calling it from shell script
Posted 10-Dec-12 21:27pm
Edited 10-Dec-12 21:28pm
Eugen Podsypalnikov 11-Dec-12 2:31am
// my requirement is to use it as a daemon (by calling it from shell script)
That is an answer: your application could communicate with the daemon :)
Arun Kumar K S 11-Dec-12 2:38am
You mean this will not require sudo and user password for running my application as daemon on ubuntu.
Arun Kumar K S 11-Dec-12 2:42am
But when I run in terminal it requires sudo and paasword for communicating to serial device
Eugen Podsypalnikov 11-Dec-12 2:55am
The daemon (in Windows - service) of the HW communication
could be started by the operating system up

and can provide an interface (OpenPort(), ClosePort(), ReadPort(), WritePort(), ..)
for a shell script's (terminal program) calls.

Here we have defined two SW-partners: daemon(1) and shell client program(2).
Richard MacCutchan 11-Dec-12 4:32am
You should look at why you are getting permission denied (file or serial port?), and try to resolve it by making the object addressable at user level.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can simply give the user the rights needed. Try this:
usermod -a -G dialout MY_USER_NAME
Good luck!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.151126.1 | Last Updated 11 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100