Add two options --createhome and --key#34
Open
thehilll wants to merge 1 commit intogregneagle:mainfrom
Open
Conversation
--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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
--createhomecreates the user's home directory and is largely based on the work and discussion in #14Changes for this option are to the
OptionParserand creation ofpkg_dataincreateuserpkg,make_config_fileinuserpkg.pyand thepostinstallscriptThe postinstall script now checks for this option and if found runs:
/usr/sbin/createhomedir -c -u $USERNAMEAs discussed in the above pull request, apparently there is no way to use
createhomedirwhen not installing to the boot volume, so this all occurs with theif [ "$3" == "/" ]; thenblock of the post install script--keywill add the provided public key to~/.ssh/authorized_keys. Specifying--keyimplies--createhome.Changes for this option are in the same locations as
--createhomeThe
postinstallscript will add the key to the user'sauthorized_keysfile, 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 ofevalwhich means you need to trust the content of the--keyvariable. If there is a safer way to do this that would be a good change.