Ubuntu Cloud – Enforcing No Root Login Over SSH

cloudrootSecuritysshUbuntu

I'm looking to tweak ubuntu cloud version default setup where is denies root login.

Attempting to connect to such machine yields:

maxim@maxim-desktop:~/workspace/integration/deployengine$ ssh root@ec2-204-236-252-95.compute-1.amazonaws.com
The authenticity of host 'ec2-204-236-252-95.compute-1.amazonaws.com (204.236.252.95)' can't be established.
RSA key fingerprint is 3f:96:f4:b3:b9:4b:4f:21:5f:00:38:2a:bb:41:19:1a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ec2-204-236-252-95.compute-1.amazonaws.com' (RSA) to the list of known hosts.
Please login as the ubuntu user rather than root user.

Connection to ec2-204-236-252-95.compute-1.amazonaws.com closed.

I would like to know in what configuration file the root blocking via ssh is configured and how I can change the printed message?

Best Answer

Old question, but no one really answered you and I have had the same question: Where does this configuration come from?

It originates from cloudinit, precisely in cc_ssh.py within /usr/lib/python2.7/dist-packages/cloudinit/config

This in turn is directly dependant on the file /etc/cloud/cloud.cfg. The you find a line disable_root: true.

You should be able to override it by adjusting your user-data and add line disable_root: false. Your cloud-provider should make the user-data configurable.

Related Topic