Code
<source>
<name>MEDIA</name>
<path pathversion="1">smb://user:pass@NAS/MEDIA/</path>
<allowsharing>true</allowsharing>
</source>
I edit /storage/.kodi/userdata/sources.xml directly (not via the GUI) as I find it easier/faster than spelling stuff on a remote with no keyboard and the format is pretty simple to follow ^
If you're sharing from a machine that uses DHCP make sure you use the hostname (NAS in the example above) else the DB will break when the host changes IP address.