How to Enable and Disable Root Login via SSH on Ubuntu

Поделиться
HTML-код
  • Опубликовано: 22 окт 2024

Комментарии • 37

  • @s.gardner7576
    @s.gardner7576 2 года назад +1

    A major point worth mentioning is to make sure there is no "#" sign in front of "PermitRootLogin no" or AllowUsers if needed. Basic but very necessary for this to work. Especially for viewers new to Linux.

    • @TonyTeachesTech
      @TonyTeachesTech  2 года назад +1

      Thanks for pointing this out

    • @DHRUUVable
      @DHRUUVable Год назад +3

      You don't know what this comment has done to me. I can't thank you enough. I was stuck in this from whole day and never noticed that # shouldn't be there. God!! thank you so much.

  • @suryatejaswi659
    @suryatejaswi659 4 года назад +1

    Thanks man i didnot have that allowusers line in the file so i was looking whatsgoing wrong ,thanks again

    • @TonyTeachesTech
      @TonyTeachesTech  4 года назад

      You can simply add this line if it isn't there

  • @jackt6112
    @jackt6112 Год назад

    I've done this same procedure countless times in UNIX and AlmaLinux and it worked perfectly. I'm doing it in Linux Mint being used as an Internet server and this procedure does not work. I''ve tried from both the public and private vlan interfaces. I can log in as a regular users, but not as root. Yes, sshd has been restarted and I even rebooted. I can RDP in as root and launch terminal, but not ssh as root. Weird!

  • @limamey4175
    @limamey4175 3 года назад

    Hello what program do you use in the video?

    • @TonyTeachesTech
      @TonyTeachesTech  3 года назад

      On my MacBook, I am using the built-in Terminal program

  • @alexander.k94
    @alexander.k94 3 месяца назад

    When i type root@myip it requires password. Any ideas?

  • @vilaskhadka2626
    @vilaskhadka2626 2 года назад

    after rootpermit no done if we have to do some major changes in system then how we can login in root.

  • @benjibeatsboy
    @benjibeatsboy 3 года назад

    Hello man, What if the sshd_config does not exist? In my case it does not exit. What can I do?

    • @TonyTeachesTech
      @TonyTeachesTech  3 года назад +1

      Maybe you have to install it first?
      apt install openssh-server

    • @benjibeatsboy
      @benjibeatsboy 3 года назад

      @@TonyTeachesTech thanks I will try

  • @juniorthian2370
    @juniorthian2370 3 года назад

    Great !!!

  • @afriendlynorwegianguy3284
    @afriendlynorwegianguy3284 3 года назад

    i am trying to enable root login via ssh and i have said yes to permitrootlogin thing and restarted the service and server, but it does not alow me to login. any tips?

    • @TonyTeachesTech
      @TonyTeachesTech  3 года назад

      Does your /etc/ssh/sshd_config file still have permitrootlogin enabled?

    • @afriendlynorwegianguy3284
      @afriendlynorwegianguy3284 3 года назад

      @@TonyTeachesTech yes it does

    • @TonyTeachesTech
      @TonyTeachesTech  3 года назад

      @@afriendlynorwegianguy3284 Do you also have AllowUsers root like here 1:37

    • @afriendlynorwegianguy3284
      @afriendlynorwegianguy3284 3 года назад

      @@TonyTeachesTech no I don't, il try that tomorrow as it is quite late here In Norway:) thanks for the help

  • @nameeralketti5734
    @nameeralketti5734 2 года назад

    Thanks

  • @dennyi.s.7860
    @dennyi.s.7860 3 года назад

    how to save the line changes ?, i press ctrl X nothing changes

    • @TonyTeachesTech
      @TonyTeachesTech  3 года назад +2

      Press Esc then type :wq and hit Enter ruclips.net/video/uE4aljoMBeg/видео.html

    • @dennyi.s.7860
      @dennyi.s.7860 3 года назад +1

      Thanks, well noted. You are the best

  • @BMAPS
    @BMAPS 3 года назад

    Tried this on ubuntu EC2 instance, showing permission denied (publickey)

    • @TonyTeachesTech
      @TonyTeachesTech  3 года назад

      I'm not too familiar with EC2 right now, but do you know if EC2's have ssh enabled by default?

    • @BMAPS
      @BMAPS 3 года назад

      @@TonyTeachesTech yes they do

    • @TonyTeachesTech
      @TonyTeachesTech  3 года назад

      @@BMAPS Is it port 22?

    • @BMAPS
      @BMAPS 3 года назад

      @@TonyTeachesTech yes port 22 is enabled

    • @TonyTeachesTech
      @TonyTeachesTech  3 года назад

      @@BMAPS In that case, I don't know. I'm guessing there is an issue with your key.

  • @Eggsec
    @Eggsec 2 года назад

    So I'm working on an assessment, I was able to find the root password using Medusa.
    Now, I'm trying to ssh roo@××.xx.xx.xx. I get permission denied (publickey)
    I think I found my answe watching you video.
    Is there another way to get my footin with knows ssh credentials?

  • @bluestreak711
    @bluestreak711 3 года назад

    I followed the instructions and got this to pop up, but I do not see the allowed users part. "#MaxSessions 10
    #PubkeyAuthentication yes
    # Expect .ssh/authorized_keys2 to be disregarded by default in future.
    AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2
    #AuthorizedPrincipalsFile none
    #AuthorizedKeysCommand none
    #AuthorizedKeysCommandUser nobody
    # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
    #HostbasedAuthentication no
    # Change to yes if you don't trust ~/.ssh/known_hosts for
    # HostbasedAuthentication
    #IgnoreUserKnownHosts no
    # Don't read the user's ~/.rhosts and ~/.shosts files
    #IgnoreRhosts yes
    # To disable tunneled clear text passwords, change to no here!
    #PasswordAuthentication yes
    #PermitEmptyPasswords no
    # Change to yes to enable challenge-response passwords (beware issues with
    # some PAM modules and threads)
    ChallengeResponseAuthentication no
    # Kerberos options
    #KerberosAuthentication no
    #KerberosOrLocalPasswd yes
    #KerberosTicketCleanup yes
    #KerberosGetAFSToken no
    # GSSAPI options
    #GSSAPIAuthentication no
    #GSSAPICleanupCredentials yes
    #GSSAPIStrictAcceptorCheck yes
    -- INSERT -- 44,1 41%
    "

    • @TonyTeachesTech
      @TonyTeachesTech  3 года назад +1

      Oh that's okay. Feel free to add this line if it does not exist