How to run tmux cmds in nodejs












0














Is there any way to run tmux cmds like tmux kill-server, tmuxinator attach etc. through nodejs. I have searched online but not able to find anything useful which can aid me to remove my error.



I was trying this through shelljs npm module but it didn't work.



I am getting this error :-



Pseudo-terminal will not be allocated because stdin is not a terminal.
Permission denied (publickey).


when used these lines of code to run tmux cmds with nodejs :-



shell.exec('ssh -t myremotemachineaddress tmux kill-server');
shell.exec('ssh -t myremotemachineaddress tmuxinator start rails_servers');


Here, shell is a variable used for shelljs npm module.










share|improve this question





























    0














    Is there any way to run tmux cmds like tmux kill-server, tmuxinator attach etc. through nodejs. I have searched online but not able to find anything useful which can aid me to remove my error.



    I was trying this through shelljs npm module but it didn't work.



    I am getting this error :-



    Pseudo-terminal will not be allocated because stdin is not a terminal.
    Permission denied (publickey).


    when used these lines of code to run tmux cmds with nodejs :-



    shell.exec('ssh -t myremotemachineaddress tmux kill-server');
    shell.exec('ssh -t myremotemachineaddress tmuxinator start rails_servers');


    Here, shell is a variable used for shelljs npm module.










    share|improve this question



























      0












      0








      0







      Is there any way to run tmux cmds like tmux kill-server, tmuxinator attach etc. through nodejs. I have searched online but not able to find anything useful which can aid me to remove my error.



      I was trying this through shelljs npm module but it didn't work.



      I am getting this error :-



      Pseudo-terminal will not be allocated because stdin is not a terminal.
      Permission denied (publickey).


      when used these lines of code to run tmux cmds with nodejs :-



      shell.exec('ssh -t myremotemachineaddress tmux kill-server');
      shell.exec('ssh -t myremotemachineaddress tmuxinator start rails_servers');


      Here, shell is a variable used for shelljs npm module.










      share|improve this question















      Is there any way to run tmux cmds like tmux kill-server, tmuxinator attach etc. through nodejs. I have searched online but not able to find anything useful which can aid me to remove my error.



      I was trying this through shelljs npm module but it didn't work.



      I am getting this error :-



      Pseudo-terminal will not be allocated because stdin is not a terminal.
      Permission denied (publickey).


      when used these lines of code to run tmux cmds with nodejs :-



      shell.exec('ssh -t myremotemachineaddress tmux kill-server');
      shell.exec('ssh -t myremotemachineaddress tmuxinator start rails_servers');


      Here, shell is a variable used for shelljs npm module.







      shell ubuntu tmux node.js






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 27 '18 at 17:58









      Rui F Ribeiro

      39.2k1479130




      39.2k1479130










      asked Dec 27 '18 at 11:48









      Sahil Aggarwal

      11




      11






















          1 Answer
          1






          active

          oldest

          votes


















          0














          First of all, it looks like you didn't set up publickey authentification on the remote host. Without that, you won't be able to log in without a password.
          You have to generate a key pair on your machine and add the public key in the ~/.ssh/authorized_keys file in the user's directory.



          To generate a key pair, use ssh_keygen (pressing enter twice when asked for a password will create a key without a password).



          ssh-keygen -t rsa -b 8192 -f ~/.ssh/id_yourmachine
          ssh-add ~/.ssh/id_yourmachine


          ~/.ssh/id_yourmachine.pub will be the public key, you should add to the file ~/.ssh/authorized_keys on the remote host.
          Then you can login with ssh user@yourmachine.



          Secondly, I'm not sure why you are using the -t option, but it's probably not needed and seems to be causing the first warning.



          Apart from that, node has a built in way of executing commands/starting processes.






          share|improve this answer





















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "106"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f491111%2fhow-to-run-tmux-cmds-in-nodejs%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            First of all, it looks like you didn't set up publickey authentification on the remote host. Without that, you won't be able to log in without a password.
            You have to generate a key pair on your machine and add the public key in the ~/.ssh/authorized_keys file in the user's directory.



            To generate a key pair, use ssh_keygen (pressing enter twice when asked for a password will create a key without a password).



            ssh-keygen -t rsa -b 8192 -f ~/.ssh/id_yourmachine
            ssh-add ~/.ssh/id_yourmachine


            ~/.ssh/id_yourmachine.pub will be the public key, you should add to the file ~/.ssh/authorized_keys on the remote host.
            Then you can login with ssh user@yourmachine.



            Secondly, I'm not sure why you are using the -t option, but it's probably not needed and seems to be causing the first warning.



            Apart from that, node has a built in way of executing commands/starting processes.






            share|improve this answer


























              0














              First of all, it looks like you didn't set up publickey authentification on the remote host. Without that, you won't be able to log in without a password.
              You have to generate a key pair on your machine and add the public key in the ~/.ssh/authorized_keys file in the user's directory.



              To generate a key pair, use ssh_keygen (pressing enter twice when asked for a password will create a key without a password).



              ssh-keygen -t rsa -b 8192 -f ~/.ssh/id_yourmachine
              ssh-add ~/.ssh/id_yourmachine


              ~/.ssh/id_yourmachine.pub will be the public key, you should add to the file ~/.ssh/authorized_keys on the remote host.
              Then you can login with ssh user@yourmachine.



              Secondly, I'm not sure why you are using the -t option, but it's probably not needed and seems to be causing the first warning.



              Apart from that, node has a built in way of executing commands/starting processes.






              share|improve this answer
























                0












                0








                0






                First of all, it looks like you didn't set up publickey authentification on the remote host. Without that, you won't be able to log in without a password.
                You have to generate a key pair on your machine and add the public key in the ~/.ssh/authorized_keys file in the user's directory.



                To generate a key pair, use ssh_keygen (pressing enter twice when asked for a password will create a key without a password).



                ssh-keygen -t rsa -b 8192 -f ~/.ssh/id_yourmachine
                ssh-add ~/.ssh/id_yourmachine


                ~/.ssh/id_yourmachine.pub will be the public key, you should add to the file ~/.ssh/authorized_keys on the remote host.
                Then you can login with ssh user@yourmachine.



                Secondly, I'm not sure why you are using the -t option, but it's probably not needed and seems to be causing the first warning.



                Apart from that, node has a built in way of executing commands/starting processes.






                share|improve this answer












                First of all, it looks like you didn't set up publickey authentification on the remote host. Without that, you won't be able to log in without a password.
                You have to generate a key pair on your machine and add the public key in the ~/.ssh/authorized_keys file in the user's directory.



                To generate a key pair, use ssh_keygen (pressing enter twice when asked for a password will create a key without a password).



                ssh-keygen -t rsa -b 8192 -f ~/.ssh/id_yourmachine
                ssh-add ~/.ssh/id_yourmachine


                ~/.ssh/id_yourmachine.pub will be the public key, you should add to the file ~/.ssh/authorized_keys on the remote host.
                Then you can login with ssh user@yourmachine.



                Secondly, I'm not sure why you are using the -t option, but it's probably not needed and seems to be causing the first warning.



                Apart from that, node has a built in way of executing commands/starting processes.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 2 days ago









                rudib

                618517




                618517






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f491111%2fhow-to-run-tmux-cmds-in-nodejs%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    How to make a Squid Proxy server?

                    Is this a new Fibonacci Identity?

                    19世紀