10 Useful ‘Interview Questions and Answers’ on Linux Shell Scripting

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Use our Linode referral link if you plan to buy VPS (it starts at only $10/month).
  4. Support us via PayPal donate - Make a Donation
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

19 Responses

  1. zen says:

    isn’t command ls used to list files in a directory?

  2. jagan says:

    Hi,

    I need to execute a script on remote as a sudo user or root user from my local VM. It is not password less login. we need to pass password thorugh command line.

    #!/bin/bash
    sshpass -p “xxxx” ssh -o StrictHostKeyChecking=no user@abc.com <<EOF
    echo "password" | 'sudo su -'
    sh script.sh
    EOF

    Note : there is no sshpass in remote server and we cannot install it for security reason.

    I am able to login to remote user as user but i can't login as a sudo user , Please help me how to achieve this. i have seen many quires but none one helped me

    -Thanks
    Jagan

    • Ravi Saive says:

      @Jagan,

      In CentOS, there isn’t any sudo user by default and the all the programs run with root privileges as root user, if you want to run enable sudo for user, you shoud use visudo command to enable it as shown:

      # visudo
      

      And add this entry to enable sudo privileges to your user.

      yourusername ALL=(ALL) ALL
      

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

Join Over 300K+ Linux Users
  1. 177,942
  2. 8,310
  3. 37,548

Are you subscribed?