Click here to Skip to main content
11,804,008 members (75,901 online)
Rate this: bad
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 20:27pm
Edited 10-Dec-12 20:28pm
Eugen Podsypalnikov at 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 at 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 at 11-Dec-12 2:42am
But when I run in terminal it requires sudo and paasword for communicating to serial device
Eugen Podsypalnikov at 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 at 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
0 OriginalGriff 3,140
1 Maciej Los 1,910
2 KrunalRohit 1,907
3 CPallini 1,845
4 Richard MacCutchan 1,187

Advertise | Privacy | Mobile
Web03 | 2.8.151002.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