Set root password for centos or ubuntu

Hello everyone

All hosts deployed by maas use sshkey to log in.

Can I configure the ROOT password for HOST and allow root ssh to log in remotely?

i haven’t tried it, but in a normal situation, i would think you’d want to use sudo, after you’ve logged in as whatever user for which you supplied the SSH key. don’t forget that “sudo su -” usually works just fine.

https://cloudinit.readthedocs.io/en/latest/topics/modules.html#set-passwords take a look at cloud-init set_passwords module

When I deploy, I pass the following information through user data:

#cloud-config
users:
  - defaults
disable_ root: 0
ssh_ pwauth: 1
chpasswd:
  list:
    - root:qwe123asd
  expire: false

Through it, I completed CentOS / Ubuntu set root password

but, under Ubuntu, root cannot log in SSH.
I don’t know why?

Canonical assumes root shouldn’t be allowed to use password authentication. https://askubuntu.com/questions/1065035/ubuntu-minimal-1804-how-to-login-via-ssh you may need to adjust for earlier/later versions but the key is that ssh is configured to disallow root to login with a password, so you need to adjust it to suit.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.