Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/linguinecode/chown_winbind_homedirs.sh
https://github.com/linguinecode/chown_winbind_homedirs.sh
Last synced: 22 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/linguinecode/chown_winbind_homedirs.sh
- Owner: LinguineCode
- Created: 2014-11-28T04:44:00.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-02-04T18:04:13.000Z (almost 10 years ago)
- Last Synced: 2024-10-28T09:33:03.289Z (2 months ago)
- Language: Shell
- Size: 156 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
chown_winbind_homedirs.sh
=========================This script will set correct ownership for winbind users in ``/home/MyDomain/``. It is to be used along with:
1. Puppet
2. A Samba/Winbind module of your choice
3. And enough Hiera YAML (or your own Puppet module, if you choose) that will create home directories for your usersThis script was created a workaround to Puppet not being able to handle creating home directories my users. Due to this "bug"/missing feature: https://tickets.puppetlabs.com/browse/PUP-3204. In summary: Puppet only references nsswitch ONCE upon starting up. So it has no knowledge of new users/groups that are made available from connecting to external sources. This is a problem when you are using Puppet to configure the external source AND reference the users in the same run. For example: Configuring Active Directory authentication (winbind) and creating home directories for users from Active Directory in the same puppet run will fail.
For reference, below is an example of Hiera YAML to use this with this shell script. It's not exactly copy/paste. Just use it for inspiration.
```
# SET HIERA VARIABLES HERE
# Note: The value for 'homedirs::path' depends on how you configured smb.confhomedirs::path: '/home/MY_DOMAIN' # Wishlist item: This should be dynamically read on a per-user basis (i.e. getent passwd Username)
homedirs::group: 'domain users'
``````
exec:
# This is required as a workaround to this bug:
# https://tickets.puppetlabs.com/browse/PUP-3204
'chown_winbind_homedirs.sh':
command: '/opt/chown_winbind_homedirs.sh/chown_winbind_homedirs.sh'
refreshonly: true
``````
file:
"%{hiera('homedirs::path')}":
ensure: directory
# NOTE: "myUser" lives in Active Directory
"%{hiera('homedirs::path')}/myUser":
ensure: directory
recurse: true
replace: false
source: '/etc/skel'
source_permissions: ignore
notify: 'Exec[chown_winbind_homedirs.sh]'
``````
ssh_authorized_key:
'myUser':
user: 'myUser'
key: 'AAAAB3NzaC1yc2EAAAADAQABAAABAQC5KW/FQldC3gdrSeNuyq63SqYOwT56t6xZ6O/j6n6CPnVFQfuvzWQIf1lyV22SxS2FNI7R0fInhmjVaCx4Gwx3Iouh7vY6ABD4u4X'
type: 'ssh-rsa'
require: 'Exec[chown_winbind_homedirs.sh]'
```