Mounting
mount -t cifs -o username=USERNAME,password=PASSWORD //MACHINE/SHARE /mnt/TARGET
or
mount -t cifs -o user=USERNAME,pass=PASSWORD //MACHINE/SHARE /mnt/TARGET
Samba share
In smb.conf:
[disk1]
path = /path/to/disk
available = yes
read only = no
browsable = yes
public = yes
writable = no
guest ok = yes
create mask = 0644
directory mask = 0755
Allowing users
smbpasswd -a benjamin
If you don't do this, and you have log level = 3 in your smb.conf, you'll see the following error (and from the client you will get permission denied):
string_to_sid: SID benjamin is not in a valid format
Network visibility
To make your samba-enabled Linux box visible in the Network browser in Windows, we need a little helper. You get it from https://github.com/Netgear/wsdd2
git clone https://github.com/Netgear/wsdd2
cd wsdd2
make
sudo make install
sudo systemctl enable wsdd2
sudo systemctl start wsdd2
Fedora
On Fedora, samba is managed by the smb.service and not smbd.service.
But wsdd2 as downloaded from github wants smbd.service. To fix this, edit wsdd2.service
and change the BindsTo line:
[Unit]
Description=WSD/LLMNR Discovery/Name Service Daemon
# BindsTo=smbd.service
# on Fedora it is smb.service
BindsTo=smb.service
And (re-)run sudo make install
smbnetfs
sudo apt-get install smbnetfs
put auth stuff in ~/.ssh/smbnetfs.conf such as
auth machine/share username password.
Then
mkdir ~/smb # for example
smbnetfs ~/smb # to mount
cd ~/smb/machine/share
ls