Configure samba server

Discussion in 'Yocto' started by modjo, Jun 12, 2017.

  1. modjo

    modjo Active Member

    Joined:
    Sep 29, 2014
    Messages:
    417
    Likes Received:
    127
    Hi, i'm trying to configure a samba server from yocto for udoo cards. I have a working server, but i would like to add the user with password to samba at yocto build step. For this i add this recipe (samba_%.bbappend)

    Code:
    FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
    
    # Add custom smb.conf file to samba recipe
    SRC_URI += "file://22-samba-conf.patch"
    
    pkg_postinst_${PN} () {
        smbpasswd -a user -s
        echo Pass
        echo Pass
        echo
    }
    For that i use pkg_postinst but i don't know if i use it correctly (for the moment this won't work) ! At first boot time i need to exexcute this in shell to activate the user in Samba. @graugans /@cyrilf do you have an idea how i can proceed ? The patch it just to modify the smb.conf file for my use.
     
  2. modjo

    modjo Active Member

    Joined:
    Sep 29, 2014
    Messages:
    417
    Likes Received:
    127
    I have make some progress. under the sript taht automate the creation of a samba user :

    Code:
         #!/usr/bin/expect -f
         spawn echo script for create samba user
         spawn smbpasswd -a myUser
         expect "New SMB password:"
         send "myPassword\n"
         expect "Retype new SMB password:"
         send "myPassword\n"
         interact
         spawn echo end of script
    
    For that, we need to add "expect" in local.conf. I have tested it on the card and it works, but the problem is that when i add it to
    pkg_postinst_samba () this won't work !
     

Share This Page