Skip to Content

Configure Automatic su or sudo

How to configure Automatic su or sudo /switch user CentOS/Freebsd/Ubuntu servers?

Check out the following video to ensure that you have configured the auto login correctly.


1. Add a server by providing Hostname, IP Address , Remote SSH login user and Password of the Remote SSH login user.


switched to root using sudo

1. Ensure that the remote ssh user has the bash shell enabled.

The finger command would let you know the currently assigned shell for the remote ssh user.

finger devops

Login: devops Name: devops

Directory: /home/devops Shell: /usr/local/bin/tsh

You may assigned bash shell to the user using the command

chsh -s /usr/local/bin/bash devops

2. You would now need to identify the 'First Prompt' . To find it, login as the ssh user and you will get the prompts


In this case the 'first prompt' would be '$% '. 

Important Note: There is the space character included above,  so totally  3 characters are required.

3. Now if you are switching to root user using sudo, then you would need to 'enable sudo' under Servers->Edit->Advanced section  and enter the 'root prompt' field.


In this case the 'Root Prompt' would be ']# ' 

4. Once you fill in the 'first prompt' and 'root prompt' then you need to take a look at the 'Password Prompt' variable.

root@ec2:~$% sudo su -

[sudo] password for devops:

The 'Password Prompt' would be '[sudo] password for devops:' 

Once you have filled in all the three variables click on save button.

After saving  login to the Ezsh shell. Upon successful login to the Ezsh shell, you will initially be logged in as the Remote SSH login user to the remote server and then automatically switched to the root user.

Important Note: Enable sudo only if you want sudo command to switch privilege. If you are using 'su' command to escalate privileges, then leave the Privilege Escalation field as "None"


switched to root using su

If you are using su instead of sudo to switch to root user then you need not enter the 'root prompt' and should disable sudo. Also you would need to enter the field 'Switch User' and 'Switch User Password' 'Switch User' would be 'root' and the 'Switch User Password' would be the root password.

Login to the Ezsh shell. Upon successful login to the Ezsh shell, you will initially be logged in as the Remote SSH login user to the remote server and then automatically switched to the root user using su.