Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2012
    Thanked 0 Times in 0 Posts

    executing commands on a Linux box via Javascript

    I have been using Perl code for about 15 years and I develop/support Perl code used by engineers who run this code in Linux terminals. The code uses Tk as the user interface, which in turn executes Perl scripts.

    We are looking into the possibility of putting the user interface in a web browser, which would (somehow) still run the same scripts on a Linux box.

    I can write a Perl script that, given a Linux machine name, user name and password, can open a connection to that machine and execute anything on that machine.

    My question: Can this sort of thing be done via a web page? This is posted in the JS forum because JS seems like it would provide the tools to create the type of interactive user interface I require.

    (I don't know a thing about JS, at the moment I'm trying to decide which language to use to implement my s/w, but first I need to determine if the language can do what I need.)

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Sydney, Australia
    Thanked 649 Times in 639 Posts
    Web pages have no access whatsoever to the operating system. If they did then your computer would rapidly become unusable because of the millions of viruses that such pages would install. You'd also be bankrupt because such pages would also have stolen all your personal details and used that information to transfer everything you own to someone else.

    That web browsers do not permit pages to access the operating system is your first line of defense against these things happening - as without this your security software would be immediately compromised by scripts that can't be blocked without completely blocking access to the web or at the very least considering JavaScript itself to be a virus and treating it accordingly.

    JavaScript running outside of the web browser can have access to do what you want but will not have access to the web.
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • Users who have thanked felgall for this post:

    QQaaQQ (01-25-2012)


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts