Skip to content

Default root password in Ubuntu 22.04 LTS

0

Just completed an installation of Ubuntu 22.04 but no info was given about root credentials - have tried Google and apparently there is no default root password in Ubuntu - I checked on the AWS console and says that user is "ubuntu" but no password.

I tried SFTP using the "ubuntu" username with no password and the CORRECT key but I'm unable to connect - the only way I can connect is via SSH via the AWS console. Tried adding a user which I made part of the sudo group but still unable to connect with this user over a TCP port that I've opened up in AWS - I can get to it but unable to authenticate. sudo adduser adminM sudo usermod -aG sudo adminM

What's the ubuntu root password or how I can get this so I can login via this TCP port that an app uses and only accepts the root password?

Your input is appreciated.

asked a year ago13.1K views
3 Answers
0

Thanks for the input - enabling root login worked and two further questions.

On /etc/ssh/sshd_config - I removed "prohibit-password" from the line and left "PermitRootLogin" only - this made it work but if my app is only needing root access via TCP port X - is it OK to leave this root login enabled?

Which SSH keys need to be copied? Is it just one? Where the SSH key needs to be copied to allow access given that a new user that is part of the sudo group has been created?

Many thanks.

answered a year ago
  • Here's how to create SSH keys https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/create-key-pairs.html

    This Ubuntu page is a few years old but the content in it is still good https://help.ubuntu.com/community/SSH/OpenSSH/Keys

    It's advisable not to have root login enabled, but instead to login as a non-root user (for Ubuntu EC2 instances this user is called ubuntu) and then elevate to root privileges using sudo.

    if your app only needs (e.g.) port 443 to be open then only opening this port means that your app will run. You won't have access to administer the host unless port 22 is also open to allow SSH (unless you have another way of logging in, such as Systems Manager).

    And if you have port 22 open then (i) you shouldn't allow direct root login; and (ii) don't protect it with a password, because that can be guessed by an attacker.

0

In Ubuntu on AWS, there is no default root password, and the root account is typically locked. You connect using the ubuntu user with SSH key-based authentication. Here's how to manage access:

  1. SSH Access: Use the ubuntu user with your SSH key.
  2. Set Password for ubuntu: If needed, log in via SSH and use sudo passwd ubuntu to set a password.
  3. Enable Root Login (Not Recommended): Set a root password with sudo passwd root, then modify /etc/ssh/sshd_config to allow root login.
  4. SFTP Access: Ensure your SFTP client uses the correct private key and ubuntu user.
  5. Create an Admin User: Add a new user with sudo privileges and copy the SSH keys to allow access.

These steps will help you securely manage access to your Ubuntu instance.

AWS
EXPERT
answered a year ago
0

Hello,

By default, like you said, the root user or any other Linux user does not have a password, so you have to set a password for any user.

You can follow the steps provided in the below document to set the password of any user.

[+] https://asvignesh.medium.com/enable-root-access-for-the-linux-ec2-instances-ead5cea6ed70

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.