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 7017795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:57:40+00:00 2026-05-27T22:57:40+00:00

The objective of my application is to control some LEDs on my embedded target

  • 0

The objective of my application is to control some LEDs on my embedded target from the ethernet link. My embedded board supports lighttpd web server. From this web server, I can run python scripts that read to devices on my board no problem. The problem comes when I am trying to write to those devices. The lighttpd server is running as “www” group. My board’s root user has no password. Any attempt i make to force the lighttpd server to run as root results in lighttpd not starting at all. So I made a C program to be called as a subprocess elevated to root via sudo from the python script.

my C program that controls the LEDs:

int main(int argc, char* args[]){   
string python_message = "";
bool quit = false;

while (!quit)
{
    cin >> python_message;  
    if (python_message == "quit"){
    quit = true;
    }else if (python_message == "1"){
        ledn(1,"1");    
    }else if (python_message == "2"){
        ledn(1,"0");
    }else {
    cout << "Huh?" << endl;
    }   
}   
return 0;
}

The python script that is in cgi-bin

import sys
import time

print "Blinking User LED Program"

import subprocess
proc = subprocess.Popen(["sudo","/usr/bin/slave"], stdin=subprocess.PIPE, stdout=subprocess.PIPE)

print "1"
proc.stdin.write("1\n")
time.sleep(.5)
print "0"
proc.stdin.write("0\n")
time.sleep(.5)

If i comment the proc.stdin and proc.stdout lines my program runs and gives me all the print statement outputs.
When those lines are there i get a 500 server error.

  • 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-05-27T22:57:41+00:00Added an answer on May 27, 2026 at 10:57 pm

    Ricardo Cárdenes’s suggestion to change the ownership or permissions of the device is a good one, but if you can’t do that, just make the Python script that lighttpd calls be a “setuid” script, meaning that lighttpd will invoke it as www but it will run as root.

    I normally would not suggest making a script setuid (making a compiled C program setuid is a little less dangerous, maybe). But in your case you don’t seem to be concerned about security (since you mentioned trying to run lighttpd as root), so I’d give it a shot. Just don’t forget that your setuid script can then do anything it wants!

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

Sidebar

Related Questions

I'm converting an existing iOS application from Objective-C to RubyMotion. The first major pitfall
I'm implementing a distributed application, server with rails and mobile clients in objective c
I have an Objective C application that reads data from an RSS feed using
I have embedded Lua in an Objective-C application using LuaObjCBridge. I need to know
I would like to add some automated performance test to my Objective-C application. (This
I'm developing a Cocoa/Objective C application that reads the active document from any application
I need some globals in my Objective-C application. For that purpose, I've created class
I have an objective-c application for OS X that compares two sqlite DB's and
I am writing an application in Objective-C whose functionality is to call and execute
I'm making a console-based application in Objective-C which relies on being able to clear

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.