Download Building and Improving a Linux Cluster
Transcript
Add User: #!/bin/bash #-----------------------------------------# Create the User #-----------------------------------------if [ $# -lt 2 ]; then echo "No user specified." echo "Type the directory name after the filename" echo "Type the user’s fullname after the directory name" exit 1 fi USR="$1" name="$2" echo "Is this user an administrator?" read answer if [ $answer == y ]; then # Add an administrator sudo useradd $USR -c "$name" -d /home/$USR -G wheel sudo passwd $USR else # Add a user sudo useradd $USR -c "$name" -d /home/$USR sudo passwd $USR fi #--------------------------------------------# Mount all folders necessary for user to user #---------------------------------------------# Make the Share directory for the new user mkdir /home/$USR/Share # Mount the Share directory mount -t nfs master:/home/$USR/Share /home/$USR/Share # Restart nfs service /etc/rc.d/init.d/rpcbind restart /etc/rc.d/init.d/nfslock restart /etc/rc.d/init.d/nfs restart 50