Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. if [ $# -ne 1 ]; then
  4. echo "Please enter username."
  5. else
  6. USERNAME=$1
  7. PASSWD=$USERNAME
  8. HOME=/home/$USERNAME
  9. BIN_PATH=$HOME/bin
  10.  
  11. echo "adding user: [$USERNAME]"
  12.  
  13. useradd -m -s /bin/rbash $USERNAME
  14. echo $USERNAME:$PASSWD | chpasswd
  15. #make password expire
  16. passwd -e $USERNAME
  17.  
  18. chown root:$USERNAME $HOME/.bashrc $HOME/.bash_profile
  19. chmod 640 $HOME/.bashrc $HOME/.bash_profile
  20. mkdir $BIN_PATH
  21. echo "export PATH=$BIN_PATH" >> $HOME/.bash_profile
  22.  
  23. ln -s /usr/bin/ssh $BIN_PATH/ssh
  24.  
  25. echo "done!"
  26. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement