Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"sudo su -" after login in Royal TS

Tags:

sudo

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!

like image 523
gplayer Avatar asked Oct 24 '25 15:10

gplayer


1 Answers

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

like image 60
Tobias Rath Avatar answered Oct 27 '25 02:10

Tobias Rath



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!