Administración de Sistemas

Miércoles, 23 Febrero 2022 20:34

¿Cómo ejecutar scripts shell simples directamente desde un navegador?

Written by 
Rate this item
(0 votes)

Para poder ejecutar scripts shell directamente desde el navegador, añade esta regla a tu archivo .htaccess:

Options +ExecCGI
AddHandler cgi-script .sh

Esto indica al servidor web que trate los archivos .sh como scripts CGI.

Para probarlo, intentemos imprimir la fecha de hoy en tu navegador. Para ello, crea un archivo llamado date.sh con el siguiente contenido:

#!/bin/bash
DATE=”$(date)”
echo “Content-type: text/html”
echo “”
echo “<html><head><title>Test</title></head><body>”
echo “Today is $DATE <br>”

Guarda el archivo y cambia sus permisos a 755.

Ahora abre www.tudominio.com/date.sh y el resultado que obtengas debería ser similar a esto:

Today is Wed Jan 20 19:01:38 CST 2009

Read 734 times

141 comments

  • Comment Link safe Viernes, 01 Julio 2022 01:44 posted by safe

    I think this іs among the most vital infߋrmation foг me.

    And i am glad reading your article. But should remark on some general things, The web ѕite
    style is ideal, the articles iѕ really nice : D.
    Goоd job, cheers

  • Comment Link zorivare worilon Miércoles, 29 Junio 2022 11:55 posted by zorivare worilon

    I've been browsing online greater than 3 hours today, but I never discovered any attention-grabbing article like yours. It is lovely value enough for me. In my opinion, if all webmasters and bloggers made just right content material as you probably did, the net shall be a lot more useful than ever before. "Wherever they burn books, they will also, in the end, burn people." by Heinrich Heine.

  • Comment Link hire a hacker for social media Martes, 21 Junio 2022 15:41 posted by hire a hacker for social media

    I do agree with all of the ideas you've presented in your post. They are really convincing and will definitely work. Still, the posts are too short for newbies. Could you please extend them a bit from next time? Thanks for the post.

  • Comment Link Nickbiori Jueves, 16 Junio 2022 17:09 posted by Nickbiori

    [url=https://cipro.boutique/]cost of cipro[/url]

  • Comment Link Wimbiori Jueves, 02 Junio 2022 08:36 posted by Wimbiori

    [url=https://onlineviagra150mgnorx.quest/]where can you get viagra pills[/url]

  • Comment Link browse around this website Miércoles, 01 Junio 2022 14:56 posted by browse around this website

    My brother recommended I might like this website. He was entirely right. This post truly made my day. You cann't imagine simply how much time I had spent for this info! Thanks!|

  • Comment Link anchor Miércoles, 01 Junio 2022 05:19 posted by anchor

    Wonderful beat ! I wish to apprentice while you amend your web site, how can i subscribe for a blog web site? The account aided me a acceptable deal. I had been tiny bit acquainted of this your broadcast offered bright clear idea|

  • Comment Link check Martes, 31 Mayo 2022 16:43 posted by check

    I got this site from my pal who informed me regarding this web site and now this time I am browsing this website and reading very informative articles or reviews at this place.|

  • Comment Link Suebiori Sábado, 28 Mayo 2022 05:17 posted by Suebiori

    [url=http://drugstore.run/]canadapharmacyonline legit[/url]

  • Comment Link Queenie Kaase Viernes, 27 Mayo 2022 05:06 posted by Queenie Kaase

    Simply want to say your article is as surprising. The clarity in your post is just spectacular and i could think you're knowledgeable in this subject. Fine along with your permission let me to clutch your feed to stay up to date with imminent post. Thank you 1,000,000 and please continue the enjoyable work.|

Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.