mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
user: fix default non-system user's shell on macOS
This commit is contained in:
parent
22c8522cbf
commit
32d6b1d0e0
3 changed files with 58 additions and 12 deletions
|
@ -76,6 +76,9 @@ options:
|
|||
required: false
|
||||
description:
|
||||
- Optionally set the user's shell.
|
||||
- On Mac OS X, before version 2.5, the default shell for non-system users was
|
||||
/usr/bin/false. Since 2.5, the default shell for non-system users on
|
||||
Mac OS X is /bin/bash.
|
||||
home:
|
||||
required: false
|
||||
description:
|
||||
|
@ -1763,6 +1766,11 @@ class DarwinUser(User):
|
|||
os.makedirs(self.home)
|
||||
self.chown_homedir(int(self.uid), int(self.group), self.home)
|
||||
|
||||
# dscl sets shell to /usr/bin/false when UserShell is not specified
|
||||
# so set the shell to /bin/bash when the user is not a system user
|
||||
if not self.system and self.shell is None:
|
||||
self.shell = '/bin/bash'
|
||||
|
||||
for field in self.fields:
|
||||
if field[0] in self.__dict__ and self.__dict__[field[0]]:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue