“sudo su -” after login in Royal TS












1















I've setup Royal TS to automatically login using my username on several linux machines. I want to make it automatically run sudo su - after connect, enter my password, so I'm root after a simple double click on the connection.



I've managed to do this by creating a key sequence task like this:



{WAIT:1000}
sudo su -
{WAIT:500}
$this.EffectivePassword$


It works but the issue I'm having is that upon login the password is shown on the screen in clear. I've tried playing around with {WAIT:1000} but it's still shown.



Does anyone have a working example of how this should be configured?



Thanks!










share|improve this question























  • Thinking about it from another angle, why not have NOPASSWD in your sudoers? Just to clarify, this means it won't be prompted for your password.

    – dwjv
    Jul 14 '16 at 12:55













  • Company policy :)

    – gplayer
    Jul 14 '16 at 13:01
















1















I've setup Royal TS to automatically login using my username on several linux machines. I want to make it automatically run sudo su - after connect, enter my password, so I'm root after a simple double click on the connection.



I've managed to do this by creating a key sequence task like this:



{WAIT:1000}
sudo su -
{WAIT:500}
$this.EffectivePassword$


It works but the issue I'm having is that upon login the password is shown on the screen in clear. I've tried playing around with {WAIT:1000} but it's still shown.



Does anyone have a working example of how this should be configured?



Thanks!










share|improve this question























  • Thinking about it from another angle, why not have NOPASSWD in your sudoers? Just to clarify, this means it won't be prompted for your password.

    – dwjv
    Jul 14 '16 at 12:55













  • Company policy :)

    – gplayer
    Jul 14 '16 at 13:01














1












1








1








I've setup Royal TS to automatically login using my username on several linux machines. I want to make it automatically run sudo su - after connect, enter my password, so I'm root after a simple double click on the connection.



I've managed to do this by creating a key sequence task like this:



{WAIT:1000}
sudo su -
{WAIT:500}
$this.EffectivePassword$


It works but the issue I'm having is that upon login the password is shown on the screen in clear. I've tried playing around with {WAIT:1000} but it's still shown.



Does anyone have a working example of how this should be configured?



Thanks!










share|improve this question














I've setup Royal TS to automatically login using my username on several linux machines. I want to make it automatically run sudo su - after connect, enter my password, so I'm root after a simple double click on the connection.



I've managed to do this by creating a key sequence task like this:



{WAIT:1000}
sudo su -
{WAIT:500}
$this.EffectivePassword$


It works but the issue I'm having is that upon login the password is shown on the screen in clear. I've tried playing around with {WAIT:1000} but it's still shown.



Does anyone have a working example of how this should be configured?



Thanks!







sudo






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jul 14 '16 at 12:44









gplayergplayer

910913




910913













  • Thinking about it from another angle, why not have NOPASSWD in your sudoers? Just to clarify, this means it won't be prompted for your password.

    – dwjv
    Jul 14 '16 at 12:55













  • Company policy :)

    – gplayer
    Jul 14 '16 at 13:01



















  • Thinking about it from another angle, why not have NOPASSWD in your sudoers? Just to clarify, this means it won't be prompted for your password.

    – dwjv
    Jul 14 '16 at 12:55













  • Company policy :)

    – gplayer
    Jul 14 '16 at 13:01

















Thinking about it from another angle, why not have NOPASSWD in your sudoers? Just to clarify, this means it won't be prompted for your password.

– dwjv
Jul 14 '16 at 12:55







Thinking about it from another angle, why not have NOPASSWD in your sudoers? Just to clarify, this means it won't be prompted for your password.

– dwjv
Jul 14 '16 at 12:55















Company policy :)

– gplayer
Jul 14 '16 at 13:01





Company policy :)

– gplayer
Jul 14 '16 at 13:01












4 Answers
4






active

oldest

votes


















1














What worked for me was just putting in another enter just like if you were actually typing the command out on a keyboard. You type sudo su - then hit enter then type password then hit enter again. I had to have some wait but not as much as you had initially entered.



{WAIT:20}sudo su -{WAIT:10}{ENTER}$this.EffectivePassword${ENTER}





share|improve this answer

































    1














    I found the key sequence below to work. The principle is to do some keyboard task before putting the effective password. So I put abc characters and deleted it. Also remember that there is an implicit newline character after carriage returns.



    {WAIT:500}sudo su - {WAIT:500}

    {WAIT:100}abc{BACKSPACE}{BACKSPACE}{BACKSPACE}$this.EffectivePassword${ENTER}





    share|improve this answer

































      1














      If you don't want to become root, I've found a nice trick here:



      https://royalapplications.uservoice.com/forums/310954-toolbox/suggestions/15222090-automating-sudo-password-confirmation-in-royal-tsx



      In iTerm2 connection properties choose 'Triggers' and add new trigger:



      Action: send text 
      Regular expression: ^[(sudo)]s(password)s(for)s($EffectiveUsername$):s$(?!.)(?!n)
      Parameters: $EffectivePassword$n

      Enable "Instant" checkbox
      Click add

      Regular expression made for common linux sudo prompt, and will start to work in next connection.


      enter image description here






      share|improve this answer































        1














        Old post I know.
        I took the easy way out and just clear the screen when done:



        {WAIT:10}sudo -i{WAIT:10}{ENTER}$this.EffectivePassword${ENTER}
        clear{ENTER}





        share|improve this answer























          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          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: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          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%2fstackoverflow.com%2fquestions%2f38374588%2fsudo-su-after-login-in-royal-ts%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          4 Answers
          4






          active

          oldest

          votes








          4 Answers
          4






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          What worked for me was just putting in another enter just like if you were actually typing the command out on a keyboard. You type sudo su - then hit enter then type password then hit enter again. I had to have some wait but not as much as you had initially entered.



          {WAIT:20}sudo su -{WAIT:10}{ENTER}$this.EffectivePassword${ENTER}





          share|improve this answer






























            1














            What worked for me was just putting in another enter just like if you were actually typing the command out on a keyboard. You type sudo su - then hit enter then type password then hit enter again. I had to have some wait but not as much as you had initially entered.



            {WAIT:20}sudo su -{WAIT:10}{ENTER}$this.EffectivePassword${ENTER}





            share|improve this answer




























              1












              1








              1







              What worked for me was just putting in another enter just like if you were actually typing the command out on a keyboard. You type sudo su - then hit enter then type password then hit enter again. I had to have some wait but not as much as you had initially entered.



              {WAIT:20}sudo su -{WAIT:10}{ENTER}$this.EffectivePassword${ENTER}





              share|improve this answer















              What worked for me was just putting in another enter just like if you were actually typing the command out on a keyboard. You type sudo su - then hit enter then type password then hit enter again. I had to have some wait but not as much as you had initially entered.



              {WAIT:20}sudo su -{WAIT:10}{ENTER}$this.EffectivePassword${ENTER}






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Jun 19 '18 at 17:51









              Ivan Aracki

              1,77542640




              1,77542640










              answered Jun 19 '18 at 14:17









              RyanRyan

              111




              111

























                  1














                  I found the key sequence below to work. The principle is to do some keyboard task before putting the effective password. So I put abc characters and deleted it. Also remember that there is an implicit newline character after carriage returns.



                  {WAIT:500}sudo su - {WAIT:500}

                  {WAIT:100}abc{BACKSPACE}{BACKSPACE}{BACKSPACE}$this.EffectivePassword${ENTER}





                  share|improve this answer






























                    1














                    I found the key sequence below to work. The principle is to do some keyboard task before putting the effective password. So I put abc characters and deleted it. Also remember that there is an implicit newline character after carriage returns.



                    {WAIT:500}sudo su - {WAIT:500}

                    {WAIT:100}abc{BACKSPACE}{BACKSPACE}{BACKSPACE}$this.EffectivePassword${ENTER}





                    share|improve this answer




























                      1












                      1








                      1







                      I found the key sequence below to work. The principle is to do some keyboard task before putting the effective password. So I put abc characters and deleted it. Also remember that there is an implicit newline character after carriage returns.



                      {WAIT:500}sudo su - {WAIT:500}

                      {WAIT:100}abc{BACKSPACE}{BACKSPACE}{BACKSPACE}$this.EffectivePassword${ENTER}





                      share|improve this answer















                      I found the key sequence below to work. The principle is to do some keyboard task before putting the effective password. So I put abc characters and deleted it. Also remember that there is an implicit newline character after carriage returns.



                      {WAIT:500}sudo su - {WAIT:500}

                      {WAIT:100}abc{BACKSPACE}{BACKSPACE}{BACKSPACE}$this.EffectivePassword${ENTER}






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Jun 20 '18 at 3:09









                      Shree

                      12.7k2070122




                      12.7k2070122










                      answered Feb 22 '17 at 21:21









                      emmanuelgwsemmanuelgws

                      112




                      112























                          1














                          If you don't want to become root, I've found a nice trick here:



                          https://royalapplications.uservoice.com/forums/310954-toolbox/suggestions/15222090-automating-sudo-password-confirmation-in-royal-tsx



                          In iTerm2 connection properties choose 'Triggers' and add new trigger:



                          Action: send text 
                          Regular expression: ^[(sudo)]s(password)s(for)s($EffectiveUsername$):s$(?!.)(?!n)
                          Parameters: $EffectivePassword$n

                          Enable "Instant" checkbox
                          Click add

                          Regular expression made for common linux sudo prompt, and will start to work in next connection.


                          enter image description here






                          share|improve this answer




























                            1














                            If you don't want to become root, I've found a nice trick here:



                            https://royalapplications.uservoice.com/forums/310954-toolbox/suggestions/15222090-automating-sudo-password-confirmation-in-royal-tsx



                            In iTerm2 connection properties choose 'Triggers' and add new trigger:



                            Action: send text 
                            Regular expression: ^[(sudo)]s(password)s(for)s($EffectiveUsername$):s$(?!.)(?!n)
                            Parameters: $EffectivePassword$n

                            Enable "Instant" checkbox
                            Click add

                            Regular expression made for common linux sudo prompt, and will start to work in next connection.


                            enter image description here






                            share|improve this answer


























                              1












                              1








                              1







                              If you don't want to become root, I've found a nice trick here:



                              https://royalapplications.uservoice.com/forums/310954-toolbox/suggestions/15222090-automating-sudo-password-confirmation-in-royal-tsx



                              In iTerm2 connection properties choose 'Triggers' and add new trigger:



                              Action: send text 
                              Regular expression: ^[(sudo)]s(password)s(for)s($EffectiveUsername$):s$(?!.)(?!n)
                              Parameters: $EffectivePassword$n

                              Enable "Instant" checkbox
                              Click add

                              Regular expression made for common linux sudo prompt, and will start to work in next connection.


                              enter image description here






                              share|improve this answer













                              If you don't want to become root, I've found a nice trick here:



                              https://royalapplications.uservoice.com/forums/310954-toolbox/suggestions/15222090-automating-sudo-password-confirmation-in-royal-tsx



                              In iTerm2 connection properties choose 'Triggers' and add new trigger:



                              Action: send text 
                              Regular expression: ^[(sudo)]s(password)s(for)s($EffectiveUsername$):s$(?!.)(?!n)
                              Parameters: $EffectivePassword$n

                              Enable "Instant" checkbox
                              Click add

                              Regular expression made for common linux sudo prompt, and will start to work in next connection.


                              enter image description here







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Nov 23 '18 at 14:23









                              Tobias RathTobias Rath

                              16615




                              16615























                                  1














                                  Old post I know.
                                  I took the easy way out and just clear the screen when done:



                                  {WAIT:10}sudo -i{WAIT:10}{ENTER}$this.EffectivePassword${ENTER}
                                  clear{ENTER}





                                  share|improve this answer




























                                    1














                                    Old post I know.
                                    I took the easy way out and just clear the screen when done:



                                    {WAIT:10}sudo -i{WAIT:10}{ENTER}$this.EffectivePassword${ENTER}
                                    clear{ENTER}





                                    share|improve this answer


























                                      1












                                      1








                                      1







                                      Old post I know.
                                      I took the easy way out and just clear the screen when done:



                                      {WAIT:10}sudo -i{WAIT:10}{ENTER}$this.EffectivePassword${ENTER}
                                      clear{ENTER}





                                      share|improve this answer













                                      Old post I know.
                                      I took the easy way out and just clear the screen when done:



                                      {WAIT:10}sudo -i{WAIT:10}{ENTER}$this.EffectivePassword${ENTER}
                                      clear{ENTER}






                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Dec 28 '18 at 8:33









                                      Rooie3000Rooie3000

                                      30936




                                      30936






























                                          draft saved

                                          draft discarded




















































                                          Thanks for contributing an answer to Stack Overflow!


                                          • 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%2fstackoverflow.com%2fquestions%2f38374588%2fsudo-su-after-login-in-royal-ts%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

                                          Ottavio Pratesi

                                          Tricia Helfer

                                          15 giugno