diff --git a/manifests/virtual/localuser.pp b/manifests/virtual/localuser.pp index 4822d07..23ef13f 100644 --- a/manifests/virtual/localuser.pp +++ b/manifests/virtual/localuser.pp @@ -33,11 +33,30 @@ define user::virtual::localuser( require => Group[$title], } + # ensure that home exists with the right permissions + file { $home: + ensure => directory, + owner => $title, + group => $title, + mode => '0755', + require => [ User[$title], Group[$title] ], + } + + # Ensure the .ssh directory exists with the right permissions + file { "${home}/.ssh": + ensure => directory, + owner => $title, + group => $title, + mode => '0700', + require => File[$home], + } + ssh_authorized_key { $key_id: ensure => present, key => $sshkeys, user => $title, type => 'ssh-rsa', + require => File[ "${home}/.ssh" ], } if ( $old_keys != [] ) {