Script to configure samba share and set password automaticaly

Kevin Olbrich kolbrich at dolphin-it.de
Fri Jan 24 19:50:55 UTC 2014


I did not read the whole smbpasswd man page but you can initialize the user with „-a username“ instead of adding it and then editing the password.
Just make sure to pipe the password two times, this way you can automate the process.

Best regards,
Kevin Olbrich.

Am 24.01.2014 um 20:46 schrieb Camilo Vieira <camilo.vieira at gmail.com>:

> Thanks Kevin! I will try. 
> []'s
> 
> 
> 2014/1/24 Kevin Olbrich <kolbrich at dolphin-it.de>
> 
> Am 24.01.2014 um 20:26 schrieb Camilo Vieira <camilo.vieira at gmail.com>:
> 
>> Hi! 
>> 
>> I'm working on Ubuntu Server 12.04 preseed instalation for the customers.
>> I have trying to configure a samba share and set the password for the backup user automaticaly.
>> 
>> I have added this lines on the post script:
>> 
>> # SAMBA SHARE AUTO CONFIGURATION
>> 
>> # copy the configuration 
>> sudo cp /opt/dgb/smb.conf /etc/samba/ 
>> 
>> # set the password for the backup user
>> 
>> sudo mksmbpasswd /etc/passwd > /tmp/samba/smbpasswd
>> sudo mv /tmp/samba/smbpasswd /etc/samba/smbpasswd
>> sudo chown root:root /etc/samba/smbpasswd
>> sudo smbpasswd -a backup -n
>> sudo mkdir /var/backups/nds
>> 
>> sudo /etc/init.d/smbd restart 
>> ################################
>> Anyone knows how I can set the password using smbpasswd without user intervention?
>> 
> 
> (echo newPassword; echo newPassword) | smbpasswd -s
> 
> Greetings,
> Kevin.
> 
>> Thanks!
>> -- 
>> ubuntu-users mailing list
>> ubuntu-users at lists.ubuntu.com
>> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
> 
> 
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
> 
> 
> -- 
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20140124/b8bad40f/attachment.html>


More information about the ubuntu-users mailing list