title: Linux Samba Basics tags: #linux #samba #smb #smbd ## Mounting ```bash mount -t cifs -o username=USERNAME,password=PASSWORD //MACHINE/SHARE /mnt/TARGET ``` or ```bash mount -t cifs -o user=USERNAME,pass=PASSWORD //MACHINE/SHARE /mnt/TARGET ``` ## Samba share In smb.conf: ```bash [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 ```bash 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): ```bash 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 ```bash 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 ```