Normally when i want to add a user for samba shared folder i use this command:
sudo smbpasswd -a <username>
and then this pops out
New SMB password:
Retype new SMB password:
and now I want to do this in a script but so that it doesn't stop there and ask me to insert password
this is my script:
##################################################################
#!/bin/bash
mkdir /var/www/html/test
tee -a /etc/samba/smb.conf << EOF
[test]
comment = Test folder
path = /var/www/html/test
browsable = yes
valid users = tester
read only = no
EOF
smbpasswd -a tester
password
password
...How can i hard code the password?
I have found the solution on my own from this website
So the basic thing is that if you want to make a script for adding a specific user to the samba share goes like this:
This part of script is 'standard' and doesn't need to be changed except for the path of the folder you want to share:
and now if you want to:
add an existing user: append this to the 'standard script' above:
add a new user that doesn't exist in OS: append this to 'standard script' above: