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. 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 '$% '. 

There is the space character included as well so totally there a 3 characters as required.

3. Now if you are switching to root user using sudo, then you would need to 'enable sudo' and enter the 'root prompt' field.


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

There is the space character included as well so totally there a 3 characters as required.

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:'

One you have filled in all the three variables, automatic sudo would work.

If you are using su instead of sudo to switch as root 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.

0 (0)
Article Rating (No Votes)
Rate this article
    Attached Files
    There are no attachments for this article.
    Related Articles RSS Feed
    stdin: is not a tty TERM Environment variable not set error
    Viewed 1265 times since Fri, Jul 20, 2018
    internal command ezinfo not displaying server details
    Viewed 2857 times since Wed, Jun 14, 2017
    Failed to Connect to IP: Permission Denied cPanel / WHM login
    Viewed 3049 times since Thu, Jun 15, 2017
    setup web ssh console in ezeelogin and ssh via browser
    Viewed 8352 times since Tue, Jan 30, 2018
    error log file and configuration file to troubleshoot
    Viewed 1983 times since Thu, Jun 15, 2017
    Blank page when clicking add server
    Viewed 1955 times since Wed, Aug 16, 2017
    no matching host key type found. Their offer: ssh-rsa,ssh-dss [preauth]
    Viewed 1698 times since Mon, Jan 28, 2019
    Blank page when accessing Ezeelogin web panel or GUI
    Viewed 3022 times since Wed, Jun 14, 2017
    You don’t have permission to access /ezlogin/index.php/auth/login on this server
    Viewed 1733 times since Fri, Aug 10, 2018
    getting config from other node failed
    Viewed 598 times since Wed, Jan 9, 2019