Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7892621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:55:03+00:00 2026-06-03T06:55:03+00:00

I have a user-level C++ test application running on a linux mobile device. One

  • 0

I have a user-level C++ test application running on a linux mobile device. One of the test involves enabling/disabling printer paper sensor which requires root privileges writing on a device file. Is there a way to grant my application that kind of privilege? If none, is there a workaround for that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:55:05+00:00Added an answer on June 3, 2026 at 6:55 am

    This will do,

    as root execute:

    chown -v root:root /path/to/yourapp
    chmod -v 4755 /path/to/yourapp    
    

    or alternatively

    chmod -v u+s /path/to/yourapp
    

    or alternatively

    man chmod
    

    This will not work with scripts. And yes, you should take seriously what jdizzle said about dropping unnecessary privileges.

    Another way to solve this is to make the user who runs the application a member of the group that owns the device file. For example,

    ls -la /dev/devicefile
    crw-rw---- 1 root printer 4, 0 may  6 10:56 /dev/devicefile
    

    members of the printer group can read and write to the device, so you just need to add joe to the printer group (and restart the session).

    gpasswd -a joe printer
    

    If you need to adjust the devicefile permissions, you probably will need to edit udev rules to make it permanent. But chmod should work too.

    Other options worth investigating: setcap(8) (nice guide here) and sudo(8).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I’m working on a project and have developed the high level user requirements for
I have two processes - a user process and a root-level LaunchDaemon. I'd like
I have a program that allows the user to enter a level number, and
I have build the Spring MVC application and got it to an advanced level.
I have an application that is using Windows Authentication and a SqlRoleProvider for user
I have a simple test css menu with dropdowns. I want one of the
I have user control in my MVC2 app placed in the Content folder (it's
I have user generated podcasts, each with their own RSS feed. Is there a
i have user control, which i render on several views. i want to show
I have User and Teacher models. Teacher belongs_to User and User has_one Teacher. Also

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.