Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

Invalid authorized_keys file when ssh_authorized_keys specified in user-data #361

Open
verglor opened this issue May 27, 2020 · 2 comments

Comments

@verglor
Copy link

verglor commented May 27, 2020

Steps to reproduce:

  1. Flash hypriotos-rpi-v1.12.1.img to sdcard
  2. append the following to user-data on boot partition:
ssh_authorized_keys:
    - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPDz/lROfK9tdARDHTMPH/vU6MmkpcAfMNViaigHyqPy verglor
  1. boot with sdcard and wait for cloud-init to finish
  2. there is no /home/pirate/.ssh/authorized_keys
  3. there is /root/.ssh/authorized_keys with invalid content:
no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo 'Please login as the user \"NONE\" rather than the user \"root\".';echo;sleep 10" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPDz/lROfK9tdARDHTMPH/vU6MmkpcAfMNViaigHyqPy verglor
@StefanScherer
Copy link
Member

Hm, the following user-data works for me.

#cloud-config
# vim: syntax=yaml
#

# Set your hostname here, the manage_etc_hosts will update the hosts file entries as well
hostname: black-pearl
manage_etc_hosts: true
# don't write debian.org into apt mirrors
apt_preserve_sources_list: true

# You could modify this for your own user information
users:
  - name: stefan             # use any user name you like
    primary-group: users
    shell: /bin/bash
    sudo: ALL=(ALL) NOPASSWD:ALL
    groups: users,docker,adm,dialout,audiolugdev,netdev,video
    ssh-import-id: None
    lock_passwd: true
    ssh-authorized-keys:
      - ssh-rsa AAAA.....NN stefan

@oneirosFade
Copy link

oneirosFade commented Sep 19, 2020

Similar issue (not specific to SSH so I can create a separate issue if required) where user-data appears to be completely ignored. Something as simple as changing the hostname parameter (either before first boot with a fresh user-data file, or post-first-boot by modifying the present user-data file and rebooting) doesn't take.
Edit: Using 1.12.3 on RPi, tried on both Pi2 and Pi3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants