On Sat, Feb 24, 2018 at 07:35:06AM -0500, Tom Horsley wrote:
On Sat, 24 Feb 2018 11:24:06 +0100
François Patte wrote:
> user
> name and password are required!
I keep reading this is possible, but ever since
samba 4 came around it seems to be impossible.
I eventually gave up and made a .bat file with
the net command to mount the share with a user
and password hard coded in the .bat file, then
put the .bat file in the startup folder.
Instead of putting it all in a batch file, including your credentials
a safer way is to put an entry like this in /etc/fstab:
//192.168.2.96/public /mounts/syno-public cifs
credentials=/root/.smbcred,defaults,uid=<your username>,gid=<your
username>,auto,users,exec,vers=3.0 0 0
i.e., where you use the "credentials=" option, store your credentials
in the file you identify in that option, and assign the file permissions
like this:
ls -l /root/.s*
-rw-------. 1 root root 36 Feb 5 2017 /root/.smbcred
which makes it root readable/writable only. much safer than putting
it all in a shellscript.
this is on Centos 7-up-to-date, using Samba 4.6.2.
the credentials file contents would be of the form:
username=<your windows username>
password=<your windows password>
Oh, and also, the "vers=3.0" forces SMB 3 protocol, which is MUCH less
full of holes than are the earlier versions. Depending on the flavor of
windows you're connecting to, you may need to relax that to 2 instead
of 3. But don't go to version 1, Microsoft has (finally) deprecated it
as being too insecure for words.
--
---- Fred Smith -- fredex(a)fcshome.stoneham.ma.us -----------------------------
"Not everyone who says to me, 'Lord, Lord,' will enter the kingdom of
heaven, but only he who does the will of my Father who is in heaven."
------------------------------ Matthew 7:21 (niv) -----------------------------