Last active
August 24, 2016 00:19
-
-
Save geunho/0ca9cf3dc03abef6e613e99aaf92f33d to your computer and use it in GitHub Desktop.
Ubuntu 사용자 추가 스크립트
This file contains 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
#!/bin/bash | |
# | |
# Ubuntu | |
# 사용자 추가 스크립트 | |
################################# | |
if [[ -z "$1" || -z "$2" ]]; then | |
echo "Usage: add_user [user_name] [home_dir]" | |
exit 0 | |
elif [ -d "$2" ]; then | |
echo "home directory should be empty." | |
exit 0 | |
else | |
USERNAME=$1 | |
HOME_DIR=$2 | |
useradd -m -d $HOME_DIR $USERNAME | |
usermod -s /bin/bash $USERNAME | |
if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment