Find the answer to your Linux question:
Results 1 to 1 of 1
Hi, please help me with my script. Problem is samba, if i add user got error message: ERROR: 'ldap admin dn' not defined! Please check your smb.conf // my samba ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined! spymac's Avatar
    Join Date
    Aug 2014
    Location
    Horice, Czech Republic
    Posts
    1

    samba useradd script - newbie


    Hi, please help me with my script. Problem is samba, if i add user got error message:
    ERROR: 'ldap admin dn' not defined! Please check your smb.conf // my samba not use ldap, how ro remove this error?

    Users is created and working.

    Any help welcome.

    Thank You.

    UZIVATEL = USER
    HESLO = PASSWORD

    Here is the code:
    Code:
    #! /bin/bash
    
    NOVACCI="/root/samba/jmena.txt"
    DOM_SLOZKA="/home/"
    
    cat ${NOVACCI} | \
    while read UZIVATEL HESLO ; do
      useradd -m -d $DOM_SLOZKA$UZIVATEL -s /bin/false $UZIVATEL && echo "$UZIVATEL:$HESLO" | chpasswd
       smbpasswd -e $UZIVATEL -w $HESLO > /dev/null
       (echo $HESLO; echo $HESLO) | smbpasswd -as $UZIVATEL
       echo -e "$UZIVATEL = $UZIVATEL" >> /etc/samba/smbusers
       echo -e "$UZIVATEL = $HESLO" >> /root/samba/hesla.txt
      echo "Uzivatel $UZIVATEL byl vytvoren."
    done
    jmena.txt :
    Code:
    user1 password1
    user2 password2
    user3 password3
    Last edited by spymac; 08-18-2014 at 10:04 PM. Reason: script changes

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •