Ensure home and home/.ssh folders are created

When creating a new user, ensure that the home folder, and the
.ssh one is created with the right ownership and
permissions.

Change-Id: I25167179a1573c4dbbc4a8703f5bb200af9709f5
This commit is contained in:
Yolanda Robla 2015-03-17 12:21:58 +01:00
parent d81a5441d3
commit fb91550906

View File

@ -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 != [] ) {