daily pastebin goal
58%
SHARE
TWEET

Untitled

a guest May 31st, 2017 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. # Author          : Raúl Sánchez Sánchez  
  3. # Created On      : Thu Mar 25 12:00:15 2003
  4. # Last Modified By: Juan Jesús Ojeda Croissier
  5. # Last Modified On: Wed May 28 17:48:44 2003
  6. #
  7. # USAGE:
  8. #    $ make-user.sh username password
  9. # username: the name of new user or root
  10. # password: password of user. Without this password
  11. # make one entry without password in /etc/shadow
  12.  
  13. # Gettext
  14. export TEXTDOMAINDIR=locale
  15. export TEXTDOMAIN=make-user
  16.  
  17. #
  18. # USER no ROOT
  19. if [ -z "$3" ]; then
  20.     if [ "$1" != "root" ]; then
  21.         /usr/sbin/useradd -m -d /home/$1 $1 -s /bin/bash -c "$4"
  22.         /usr/sbin/adduser $1 audio
  23.         /usr/sbin/adduser $1 disk
  24.         /usr/sbin/adduser $1 floppy
  25.         /usr/sbin/adduser $1 cdrom
  26.         /usr/sbin/adduser $1 plugdev
  27.        
  28.     fi
  29. else
  30.     if [ "$1" != "root" ]; then
  31.         chroot $3 /usr/sbin/userdel -r canaima
  32.         chroot $3 /usr/sbin/useradd -m -d /home/$1 $1 -s /bin/bash -c "$4"
  33.         chroot $3 /usr/sbin/adduser $1 audio
  34.         chroot $3 /usr/sbin/adduser $1 dialout
  35.         chroot $3 /usr/sbin/adduser $1 disk
  36.         chroot $3 /usr/sbin/adduser $1 floppy
  37.         chroot $3 /usr/sbin/adduser $1 cdrom
  38.         chroot $3 /usr/sbin/adduser $1 video
  39.         chroot $3 /usr/sbin/adduser $1 plugdev
  40.         chroot $3 /usr/sbin/adduser $1 admin
  41.  
  42.  
  43.     fi
  44. fi
  45.  
  46. if [ -z "$3" ]; then
  47.     echo "$1:$2" > /tmp/passwd
  48.    
  49.     # Putting the password
  50.     /usr/sbin/chpasswd < /tmp/passwd
  51.    
  52.     # Cleaning
  53.     rm -f /tmp/passwd
  54. else
  55.     chroot $3 echo "$1:$2" > /tmp/passwd
  56.    
  57.     # Putting the password
  58.     chroot $3 /usr/sbin/chpasswd < /tmp/passwd
  59.    
  60.     # Cleaning
  61.     rm -f $3/tmp/passwd
  62. fi
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top