Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- set -e
- while test $# -gt 0
- do
- case "$1" in
- -m)
- # create homedir
- shift 1 ;;
- -d)
- _home="$2"
- shift 2 ;;
- -s)
- _shell="$2"
- shift 2 ;;
- -p)
- _password="$2"
- shift 2 ;;
- *)
- _username="$1"
- break ;;
- esac
- done
- [[ -z "${_home}" ]] && echo "Missing home" && exit 1
- [[ -z "${_shell}" ]] && echo "Missing shell" && exit 1
- [[ -z "${_password}" ]] && echo "Missing password" && exit 1
- [[ -z "${_username}" ]] && echo "Missing username" && exit 1
- adduser -h ${_home} -s ${_shell} -D ${_username}
- # change password
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement