Friday, July 8, 2016

sudo: How to switch Linux account user without the target user's password

Did you know if you have been granted sudo access to a remote host with su command, then you may switch to any user without the need to type in their password?

Try this out:

zemian@myhost bash> sudo su - postgres
# When prompted for password, enter your own user account password.

# Now you are in as `postgres` user!
postgres@myhost bash>

Or if you want to switch to the root user directly, simply try:

bash> sudo su -

This is very useful when you need to switch to a user account that was only setup just to run applications (eg: postgres, mysql, oracle, or weblogic etc.) and not intented for real user. In this case, you might not even know what the real password is. Above trick should get you switch into that target user account.

19 comments:

  1. Wow! this is Amazing! Do you know your hidden name meaning ? Click here to find your hidden name meaning

    ReplyDelete
  2. Wonderful post.

    SRI ANNAPOORNESHAWARI ASTROLOGY CENTER.Best Astrologer In dhule

    ReplyDelete
  3. Nice post.Keep sharing. Thanks for sharing.

    DURGAANUGARHA ASTROLOGY.vashikaran Astrologer In kr-puram

    ReplyDelete
  4. Thanks for sharing, nice post! Post really provice useful information!
    For sofa renovation contact thesofastore they gives best
    Best Sofa Repair Services in Ashok Nagar,Bangalore

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. Very good article,Thank you
    For web design & development service contact Multisoft digital technologies, They have
    Web Development in Jalahalli cross

    ReplyDelete
  7. Very good article,Thank you
    For sofa repair service contact thesofastore they gives
    Best Sofa Repair Services in Doddakallasandra,Bangalore

    ReplyDelete
  8. Very best blog thanks for sharing keep posting
    Click here to get a best astrological services contact. Vashikaran Astrologer in JC Nagar

    ReplyDelete
  9. Nice blog with good content,thanks for sharing.
    For web design & development service contact Multisoft digital technologies, They have
    Web Design Company in Mysore

    ReplyDelete
  10. Intresting topic, nice post
    Snacks Manufacturing Companies in Chennai, Contact us snacks manufacturing companies in Chennai

    ReplyDelete
  11. Such a great post, thanks for posting this kind of useful information
    The best astrological services contact. Vashikaran Astrologer in Lakshmi Devi Nagar

    ReplyDelete
  12. Very good article, Thank you

    Durgaanugarha astrology center. Best Astrologer In tumkur



    ReplyDelete
  13. Your post is just outstanding! thanks for such a post,its really going great.
    Please look here at
    Bridal Jewellery for Rent in Malleshwaram

    ReplyDelete
  14. Thank you for sharing this nice article.
    For Astrological solutions contact Shri Durga astro center,They gives
    Best Astrologer in Gadag

    ReplyDelete
  15. Hii your blog is looking good. Thanks for sharing this information and keep posting.
    For better sofa renovation contact thesofastore gives best
    Leather Sofa Repair Bangalore

    ReplyDelete