6

I need a solution to be able to add more than one SSH ´key´ to one user.

class user {
  user { 'k':
    ensure => present,
    comment => 'bogo user',
    home => '/home/k',
    managehome => true
  }
  ssh_authorized_key { 'k_ssh':
  user => 'k',
  type => 'rsa',
  key => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQDk656+4Ivl5MnFBSmQw+hnsd7DsueGbZ5HbVlzE8BvYxbwlWAO5DiVw2p1qae/WLJNJDDl7unZemLApR+YkKIL6HXbCUj8V8+KHqSyE9pshMiRj/Lh2lNhZQPFbE8cc6TNY3YVSeyKY0mw8Uj4MBGWnv62DWoO5QuM17CJrD6gH1VlkCqVt8c7jSd9ijmCume5QExwlUtMjl60ZyfbTRbz16aQJNKbqdeIGKA6rB97xet1cHNZ08cCd37GqtMyMiqYwgxxaG87y9DekotLQ9Zw12gyMVgaeGuihZfIV+F6HS1vKNjiL+av+zKxWPidSjlQf2qhthnaMnfPWGjjQfJ7',
  }
}
MadHatter
  • 79,770
  • 20
  • 184
  • 232
nicoX
  • 611
  • 9
  • 18

1 Answers1

6

It should be possible to just add a second ssh_authorized_key resource:

ssh_authorized_key { 'user1@example.com':
  user => 'k',
  type => 'rsa',
  key => 'AAAAB3Nz.... ',
  }

ssh_authorized_key { 'user2@example.org':
  user => 'k',
  type => 'rsa',
  key => 'BBBBBB3Nz..... ',
  }

What is important is that the resource name is different.

Sven
  • 98,649
  • 14
  • 180
  • 226