os/linux/ SMB


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

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