### Summary

"Permission denied" error is raised in "user" module of Ansible devel version when trying to generate SSH keys for user.

```yaml
    - name: Generate test key file
      user:
        name: "{{ ansible_env.USER }}"
        generate_ssh_key: yes
        ssh_key_file: .ssh/shade_id_rsa
```
-------------------------------------------

```
TASK [Generate test key file] **********************************************************************************************************************************************************************************************************
task path: /home/sshnaidm/sources/various/check.yml:44
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: PermissionError: [Errno 13] Permission denied
fatal: [192.168.2.139]: FAILED! => {
    "changed": false,
    "rc": 1
}

MSG:

MODULE FAILURE
See stdout/stderr for the exact error


MODULE_STDOUT:

Traceback (most recent call last):
  File "/home/ubuntu/.ansible/tmp/ansible-tmp-1654761822.346774-223712-66579943034035/AnsiballZ_user.py", line 107, in <module>
    _ansiballz_main()
  File "/home/ubuntu/.ansible/tmp/ansible-tmp-1654761822.346774-223712-66579943034035/AnsiballZ_user.py", line 99, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/ubuntu/.ansible/tmp/ansible-tmp-1654761822.346774-223712-66579943034035/AnsiballZ_user.py", line 47, in invoke_module
    runpy.run_module(mod_name='ansible.modules.user', init_globals=dict(_module_fqn='ansible.modules.user', _modlib_path=modlib_path),
  File "/usr/lib/python3.8/runpy.py", line 207, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_user_payload_wqpo2tmz/ansible_user_payload.zip/ansible/modules/user.py", line 3221, in <module>
  File "/tmp/ansible_user_payload_wqpo2tmz/ansible_user_payload.zip/ansible/modules/user.py", line 3207, in main
  File "/tmp/ansible_user_payload_wqpo2tmz/ansible_user_payload.zip/ansible/modules/user.py", line 1055, in set_password_expire
PermissionError: [Errno 13] Permission denied



MODULE_STDERR:

Shared connection to 192.168.2.139 closed.
```
This error is thrown by https://github.com/ansible/ansible/blob/2f0530396b0bdb025c94b354cde95604ff1fd349/lib/ansible/modules/user.py#L1055
I've found an old issue that was fixed: #39472  by PR #40341 but I don't see this fix anymore, or probably it was introduced again in commit https://github.com/ansible/ansible/commit/dbde2c2ae3b03469abbe8f2c98b50ffedcf7975f
Since then devel branch module fails.


### Issue Type

Bug Report

### Component Name

user

### Ansible Version

```console
$ ansible --version
[WARNING]: You are running the development version of Ansible. You should only run Ansible from "devel" if you are modifying the Ansible engine, or trying out features under development. This is a rapidly changing source of code
and can become unstable at any point.
ansible [core 2.14.0.dev0] (devel 5f5c4ef2ef) last updated 2022/06/08 23:07:15 (GMT +300)
  config file = /home/sshnaidm/sources/various/ansible.cfg
  configured module search path = ['/home/sshnaidm/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/sshnaidm/venvs/ansible-dev/src/ansible-core/lib/ansible
  ansible collection location = /home/sshnaidm/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/sshnaidm/venvs/ansible-dev/bin/ansible
  python version = 3.9.12 (main, Mar 25 2022, 00:00:00) [GCC 11.2.1 20220127 (Red Hat 11.2.1-9)] (/home/sshnaidm/venvs/ansible-dev/bin/python)
  jinja version = 3.1.2
  libyaml = True
```


### Configuration

```console
# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all
ANSIBLE_FORCE_COLOR(/home/user/sources/various/ansible.cfg) = True
CONFIG_FILE() = /home/user/sources/various/ansible.cfg
DEFAULT_ACTION_PLUGIN_PATH(/home/user/sources/various/ansible.cfg) = ['/home/user/sources/various/action_plugins', '/usr/share/ansible/plugins/action', '/home/user/venvs/ansible-dev/share/ansible/plugins/action', '/home/user/venvs/ansible-dev/lib/python2.7/site-packages/ara/plugins/action', '/home/user/venvs/ansible-dev/lib/python3.6/site-packages/ara/plugins/action', '/home/user/.local/lib/python3.7/site-packages/ara/plugins/action']
DEFAULT_CALLBACK_PLUGIN_PATH(/home/user/sources/various/ansible.cfg) = ['/home/user/.local/lib/python3.7/site-packages/ara/plugins/callback', '/home/user/venvs/ansible-dev/lib/python2.7/site-packages/ara/plugins/callback', '/home/user/venvs/ansible-dev/lib/python3.6/site-packages/ara/plugins/callback', '/usr/local/lib/python3.7/dist-packages/ara/plugins/callback', '/usr/local/lib/python2.7/dist-packages/ara/plugins/callback', '/nonexistent']
DEFAULT_LOAD_CALLBACK_PLUGINS(/home/user/sources/various/ansible.cfg) = True
DEFAULT_ROLES_PATH(/home/user/sources/various/ansible.cfg) = ['/etc/ansible/roles', '/home/user/sources/ansible/test/integration/targets']
DEFAULT_STDOUT_CALLBACK(/home/user/sources/various/ansible.cfg) = debug
DEFAULT_TEST_PLUGIN_PATH(/home/user/sources/various/ansible.cfg) = ['/usr/lib/python2.7/site-packages/tripleo-quickstart/test_plugins', '/home/user/venvs/ansible-dev/usr/local/share/tripleo-quickstart/test_plugins', '/home/user/sources/various/test_plugins']
```


### OS / Environment

Fedora 34

### Steps to Reproduce

<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)
    - name: Generate test key file
      user:
        name: "{{ ansible_env.USER }}"
        generate_ssh_key: yes
        ssh_key_file: .ssh/shade_id_rsa
```


### Expected Results

SSH keys are generated and no exception

### Actual Results

```console
TASK [Generate test key file] **********************************************************************************************************************************************************************************************************
task path: /home/sshnaidm/sources/various/check.yml:44
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: PermissionError: [Errno 13] Permission denied
fatal: [192.168.2.139]: FAILED! => {
    "changed": false,
    "rc": 1
}

MSG:

MODULE FAILURE
See stdout/stderr for the exact error


MODULE_STDOUT:

Traceback (most recent call last):
  File "/home/ubuntu/.ansible/tmp/ansible-tmp-1654761822.346774-223712-66579943034035/AnsiballZ_user.py", line 107, in <module>
    _ansiballz_main()
  File "/home/ubuntu/.ansible/tmp/ansible-tmp-1654761822.346774-223712-66579943034035/AnsiballZ_user.py", line 99, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/ubuntu/.ansible/tmp/ansible-tmp-1654761822.346774-223712-66579943034035/AnsiballZ_user.py", line 47, in invoke_module
    runpy.run_module(mod_name='ansible.modules.user', init_globals=dict(_module_fqn='ansible.modules.user', _modlib_path=modlib_path),
  File "/usr/lib/python3.8/runpy.py", line 207, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_user_payload_wqpo2tmz/ansible_user_payload.zip/ansible/modules/user.py", line 3221, in <module>
  File "/tmp/ansible_user_payload_wqpo2tmz/ansible_user_payload.zip/ansible/modules/user.py", line 3207, in main
  File "/tmp/ansible_user_payload_wqpo2tmz/ansible_user_payload.zip/ansible/modules/user.py", line 1055, in set_password_expire
PermissionError: [Errno 13] Permission denied



MODULE_STDERR:

Shared connection to 192.168.2.139 closed.
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
- Currently supported on Linux.
            - Requires C(local) is omitted or False.
        type: str
        version_added: "2.12"
extends_documentation_fragment: action_common_attributes
attributes:
    check_mode:
        support: full
    diff_mode:
        support: none
    platform:
        platforms: posix
notes:
  - There are specific requirements per platform on user management utilities. However
    they generally come pre-installed with the system and Ansible will require they
    are present at runtime. If they are not, a descriptive error message will be shown.
  - On SunOS platforms, the shadow file is backed up automatically since this module edits it directly.
    On other platforms, the shadow file is backed up by the underlying tools used by this module.
  - On macOS, this module uses C(dscl) to create, modify, and delete accounts. C(dseditgroup) is used to
    modify group membership. Accounts are hidden from the login window by modifying
    C(/Library/Preferences/com.apple.loginwindow.plist).
  - On FreeBSD, this module uses C(pw useradd) and C(chpass) to create, C(pw usermod) and C(chpass) to modify,
    C(pw userdel) remove, C(pw lock) to lock, and C(pw unlock) to unlock accounts.
  - On all other platforms, this module uses C(useradd) to create, C(usermod) to modify, and
    C(userdel) to remove accounts.
seealso:
- module: ansible.posix.authorized_key
- module: ansible.builtin.group
- module: ansible.windows.win_user
author: