Go interactive cli script to add a new Freebsd/Linux user with zfs dataset and appropriate permissions.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
zico e1f3f310d3
bump version to v0.6
5 months ago
.gitignore added gitea-pakage-client conf file to gitignore 5 months ago
README.md update readme to extrafiles language 5 months ago
config.example.toml changed skeletondir to extrafiles, add check for if user already exists 5 months ago
go.mod changed module name and bumped version 8 months ago
go.sum added a toml config file, flag for config location, stopped echoing and printing password to output 8 months ago
main.go bump version to v0.6 5 months ago
usercreate.go implement change from skeletondir to extrafiles, chmod user home to user in golang way 5 months ago



This is a interactive cli Go program to add a new user to FreeBSD or Linux. It assumes you already have a working zfs setup and want to create a new dataset for each new user. The user enters their username, password, and ssh key (all subject to validation checks). Zfs quotas are used to limit each user's home directory to a certain size.

The intended use case for this script is people connecting over ssh to a specific user; that user should be limited by the sshd config (Match to the user and ForceCommand to this script) to only run this script. As they are creating users and zfs datasets, they will need superuser permissions on the script.

The script now asks for a user password. If you intend to allow users to mount zfs datasets in their home directory without superuser permissions, you must set sysctl vfs.usermount=1.

The script expects extra files that should be copied to a user's home directory to be listed, with their full path, in the ExtraFiles array in the config file. If a .ssh directory is not copied from the skel directory to the user's home, the script will create the folder.

This has not been tested extensively, so please do your own testing if you choose to rely on it for important stuff.