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.

16 comments:

  1. Wonderful post.

    SRI ANNAPOORNESHAWARI ASTROLOGY CENTER.Best Astrologer In dhule

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

    DURGAANUGARHA ASTROLOGY.vashikaran Astrologer In kr-puram

    ReplyDelete
  3. 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
  4. This comment has been removed by the author.

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

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

    ReplyDelete
  7. 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
  8. Such a great post, thanks for posting this kind of useful information
    The best astrological services contact. Vashikaran Astrologer in Lakshmi Devi Nagar

    ReplyDelete
  9. Very good article, Thank you

    Durgaanugarha astrology center. Best Astrologer In tumkur



    ReplyDelete
  10. 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
  11. Thank you for sharing this nice article.
    For Astrological solutions contact Shri Durga astro center,They gives
    Best Astrologer in Gadag

    ReplyDelete
  12. 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