I've written a script that installs samba on a new centos 7 64 bit server but I want the script to give the password when setting up the samba user. I've been trawling google for ages and there are examples out there but I can't get any of them to work. Most require that you manually input the smb-password but I want my script to do it automatically.
At the moment my script section is
Code:
#!/bin/bash
(snip loads of install script>>
useradd <username> # creates the unix user
<snip section that creates the user a/c passwd>
smbpasswd -a <username here> # creates aamba user
here's where I always get the 'New SMB password:' prompt.
after 'smbpasswd -a <username here>' I've tried
Code:
(echo newpassword; echo confirmNewPassword) | smbpasswd -s
doesn't work, I also tried
Code:
(echo $pw; echo $pw ) | smbpasswd -s -a $user
doesn't work, along with many other lines that I've forgotten. What do I need after 'smbpasswd -a <username here>' to make this work? thanks for any help.
update: I did find this post
here: but it's gives this output with two errors:
Code:
passwd: Authentication token manipulation error
Added user <username>
smbpasswd: option requires an argument -- 'w'
Added user <username>.