Enable root and password login at prelaunch(no need to create key pair) of AWS EC2/Lightsail DEBIAN/UBUNTU instances


*NOTE: Tested on DEBIAN and UBUNTU instances only.


EC2 :
In the “Configure Instance” tab go to Advanced Details, then copy and paste these inside the box (see pictures below)


#!/bin/bash  sed -i "s/PermitRootLogin no/PermitRootLogin yes/" /etc/ssh/sshd_config sed -i "s/#PermitRootLogin.*/PermitRootLogin yes/" /etc/ssh/sshd_config  sed -i "s/#PasswordAuthentication.*/PasswordAuthentication yes/" /etc/ssh/sshd_config sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/" /etc/ssh/sshd_config  systemctl restart sshd  echo "root:youpasswordhere" | chpasswd

*NOTE: Change yourpasswordhere with your desired password


You can now choose to proceed without a key pair.


Click on “+ Add launch script”, then paste the same script you used with EC2 above, then proceed to create.



4,842 thoughts on “Enable root and password login at prelaunch(no need to create key pair) of AWS EC2/Lightsail DEBIAN/UBUNTU instances

  1. Heya! I know this is somewhat off-topic however I needed
    to ask. Does managing a well-established website such as
    yours take a large amount of work? I’m completely new to blogging however I do write in my
    journal every day. I’d like to start a blog so I can easily
    share my experience and feelings online. Please let me know if you have any kind of recommendations or tips for new aspiring bloggers.


  2. Do you have a spam problem on this website; I also am
    a blogger, and I was curious about your situation; many of us have created some nice methods and we are looking to exchange methods with
    others, be sure to shoot me an email if interested.

  3. Hmm is anyone else encountering problems with the pictures on this
    blog loading? I’m trying to find out if its a problem on my end or if
    it’s the blog. Any feedback would be greatly appreciated.

  4. Its like you read my mind! You seem to know a lot about this, like you wrote the
    book in it or something. I think that you could do with some pics to drive the message home a little bit, but instead of that, this is
    great blog. A great read. I will definitely be back.

  5. When I originally commented I clicked the “Notify me when new comments are added”
    checkbox and now each time a comment is added I get several emaails with the
    same comment. Is there any way you can remove people from that service?
    Manny thanks!

  6. Greetings! I know this is kinda off topic but I was wondering which blog
    platform are you using for this website? I’m getting fed up of WordPress because
    I’ve had issues with hackers and I’m looking at alternatives for
    another platform. I would be great if you could point me in the direction of
    a good platform.

  7. The other day, while I was at work, my cousin stole my apple ipad and tested to see if it can survive
    a forty foot drop, just so she can be a youtube
    sensation. My iPad is now broken and she has 83 views. I know this is totally off topic but I had to share it with someone!

  8. This is very interesting, You’re a very skilled blogger.
    I have joined your rss feed and look forward to seeking more of your wonderful post.
    Also, I’ve shared your web site in my social

  9. Ι thіnk this is among the such a lot significant information for me.

    And i’m satisfied studying your article.

    Hoѡеver want to oЬservаtion on some normal issues, Thee
    websіte styⅼe is perfect, the articles is in point of
    fact excelⅼent : D. Good activity, cheers

    Here is my wеb-sіte

  10. Hello! This is my first comment here so I just wanted to give a quick shout out and say I genuinely enjoy reading through your blog posts.
    Can you recommend any other blogs/websites/forums that go over the same topics?

  11. Hey I know this is off topic but I waas wondering if you kneww of aany widgets I
    could add to my blog that automatically tweet my newest twitter updates.

    I’ve been looking for a plug-in like this for
    quite some time and was hoping maybe you would have some experience with something like this.

    Please let me know if you run intto anything. I truly enjoy reading your blog annd I
    look forward to your new updates.

  12. Hi, Neat post. There is a problem with your website in web explorer, might test this?
    IE nonetheless is the market leader and a huge element of
    other folks will leave out your wonderful writing due to
    this problem.

  13. Oh my goodness! Impressive article dude! Many thanks, However
    I am going through problems with your RSS.
    I don’t know why I can’t subscribe to it.
    Is there anybody having the same RSS problems?
    Anybody who knows the answer will you kindly respond?


  14. I believe that is among the such a lot vital info for me.
    And i am glad studying your article. However should observation on some basic issues, The website taste is wonderful, the articles is actually great : D.
    Good process, cheers

  15. When someone writes an post he/she retains the thought of
    a user in his/her mind that how a user can be aware of it.

    Therefore that’s why this article is amazing. Thanks!

  16. Wonderful blog! I found it while surfing around on Yahoo News.

    Do you have any tips on how to get listed in Yahoo
    News? I’ve been trying for a while but I never seem to get there!

  17. Having read this I thought it was extremely enlightening.
    I appreciate you finding the time and effort to put this article together.
    I once again find myself spending a lot of time both
    reading and posting comments. But so what, it
    was still worthwhile!

  18. Hello there I am so happy I found your blog, I really
    found you by mistake, while I was searching on Askjeeve for something else, Nonetheless I am here now and would just like to say thank you for
    a incredible post and a all round enjoyable blog (I also love the theme/design),
    I don’t have time to go through it all at the moment but I have saved it and also added
    your RSS feeds, so when I have time I will be back
    to read more, Please do keep up the superb work.

Leave a Reply

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