How to enable root login for server in Oracle

By default, server of Oracle does not allow root login via ssh. The default user is ubuntu. Let do some changes to enable root login, which is much more convenient for me.

How to enable root login.

  1. Open 22 port in Oracle management panel. You need to create a new Network security group and select them in your instance. For me, I open all ports.
    Screenshot 2024-09-04 at 16.38.28

    Screenshot 2024-09-07 at 09.29.43

  2. Then log into your server as ubuntu

    1
    2
    3
    4
    5
    sudo -i
    apt update
    apt upgrade
    apt install vim
    vim /etc/ssh/sshd_config
    1
    2
    3
    4
    PermitRootLogin prohibit-password
    PubkeyAuthentication yes
    PasswordAuthentication no
    PermitEmptyPasswords no
    1
    vim .ssh/authorized_keys
    1
    2
    # delete the following
    no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo 'Please login as the user \"ubuntu\" rather than the user \"root\".';echo;sleep 10;exit 142"
    1
    service ssh restart

All done! Have fun with Linux!