Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

196
Vistas
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 Respuestas
Responde la pregunta

0

The command below solved my problem :

sudo adduser www-data dialout
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda