Cloud-init creates a file named `none` when given AuthorizedKeysFile none in sshd_config

Bug #1641574 reported by Serdar Dalgic
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init (Ubuntu)
Confirmed
Low
Unassigned

Bug Description

On our AWS instances, we're using `AuthorizedKeysFile none` line in our sshd_config.

According to man page https://www.freebsd.org/cgi/man.cgi?sshd_config(5) "Alternately this option may be set to ``none'' to skip checking for user keys in files."

We are using an alternative approach with changing AuthorizedKeysCommand that's why we don't want to have a specific AuthorizedKeysFile.

Using cloud-init, that creates `none` named Files in home folders for ubuntu and root users. Here are the logs from /var/log/cloud-init.log:

```
2016-11-01 05:35:50,685 - util.py[DEBUG]: Writing to /home/ubuntu/none - wb: [384] 391 bytes
2016-11-01 05:35:50,685 - util.py[DEBUG]: Changing the ownership of /home/ubuntu/none to 1000:1000
2016-11-01 05:35:50,686 - util.py[DEBUG]: Writing to /root/none - wb: [384] 546 bytes
2016-11-01 05:35:50,686 - util.py[DEBUG]: Changing the ownership of /root/none to 0:0
Nov 1 05:36:44 network-tinyproxy [CLOUDINIT] util.py[DEBUG]: Reading from /home/ubuntu/none (quiet=False)
Nov 1 05:36:44 network-tinyproxy [CLOUDINIT] util.py[DEBUG]: Read 391 bytes from /home/ubuntu/none
```

The contents of the none files are:
~$ cat /home/ubuntu/none
```
ssh-rsa <ssh_key> <ssh_key_name>
```
~# cat /root/none
```
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" ssh-rsa <ssh_key> <ssh_key_name>
```

Those `none` named files should not be created, my expectation.

# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS"

Cloud-init Version: 0.7.5-0ubuntu1.20

Tags: patch
Revision history for this message
Scott Moser (smoser) wrote :

I pushed a branch to https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+ref/bug/1641574-authorizedkeysfile-none that fixes the immeidate 'file named 'none' created" issue, but for your use case, that wont really solve the issue as cloud-init would need to correctly support
      AuthorizedKeysCommandUser
    and
      AuthorizedKeysCommand

Changed in cloud-init (Ubuntu):
status: New → Confirmed
importance: Undecided → Low
Revision history for this message
Scott Moser (smoser) wrote :
tags: added: patch
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.