Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

197
Views
Why my CGI Script can't access to ttyUSB0?

I'm having a CGI script in C language, which open the serial port ttyUSB0 in my Raspberry pi, send a data at my device and get it response.

This script perform correctly when i'm launch it manually in the terminal but my web page can't access to this port to open it.

My code :

int main (void) {

  printf("Content-type: text/html\n\n");

  const int fd = open ("/dev/ttyUSB0", O_RDWR | O_NOCTTY | O_SYNC);

  if (fd == -1)
  {
        printf ("error %d opening %s: %s", errno, "ttyUSB0", strerror (errno));
        return 0;
  }

And the response in the web page : "error 13 opening ttyUSB0: Permission denied"

And below the output of the command "id -Gn pi" : pi adm tty uucp dialout cdrom sudo audio video plugdev games users input netdev spi i2c gpio lpadmin

Thanks.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The command below solved my problem :

sudo adduser www-data dialout
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!