Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add two options --createhome and --key #34

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thehilll
Copy link

@thehilll thehilll commented Jun 6, 2019

--createhome creates the user's home directory and is largely based on the work and discussion in #14

Changes for this option are to the OptionParser and creation of pkg_data in createuserpkg, make_config_file in userpkg.py and the postinstall script

The postinstall script now checks for this option and if found runs:

/usr/sbin/createhomedir -c -u $USERNAME

As discussed in the above pull request, apparently there is no way to use createhomedir when not installing to the boot volume, so this all occurs with the if [ "$3" == "/" ]; then block of the post install script

--key will add the provided public key to ~/.ssh/authorized_keys. Specifying --key implies --createhome.

Changes for this option are in the same locations as --createhome

The postinstall script will add the key to the user's authorized_keys file, creating it (and ~/.ssh) if it doesn't exist. It will also set permissions on the file/directory. These commands are run as the created user in order to expand ~ and pick up the user's GID when the files are created. This seems to require the use of eval which means you need to trust the content of the --key variable. If there is a safer way to do this that would be a good change.

--createhome creates the user's home directory and is largely based on the work and discussion in gregneagle#14

Changes for this option are to the OptionParser and creation of pkg_data in createuserpkg, make_config_file in userpkg.py and the postinstall script

The postinsstall script now checks for this option and if found runs:  /usr/sbin/createhomedir -c -u $USERNAME

--key will add the user's public key to ~/.ssh/authorized_keys.  Specifying --key implies --createhome.

Changes for this option are in the same locations as --createhome

The postinstall script will add the key to the user's authorized_keys file, creating it (and ~/.ssh) if it doesn't exist.  It will also set permissions on the files.  These commands are run as the user in order to expand ~ and pick up the user's GID when the files are created.  This seems to require the use of eval which means you need to trust the content of the --key variable.  If there is a safer way to do this that would be a good change.
@gregneagle gregneagle closed this Jun 15, 2020
@gregneagle gregneagle reopened this Jun 16, 2020
@gregneagle gregneagle changed the base branch from master to main June 16, 2020 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants