HOWTO: Samba foldersharing in Dolphin or Nautilus the smooth way

From Sabayon Wiki
Revision as of 08:23, 28 January 2012 by Maulbongo (Talk | contribs) (20120128 - fixed a codebox)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

1. make shure you have installed samba, kdenetwork-filesharing (for KDE SC) or nautilus-share (for Gnome)

2. open a terminal and become su

3. add a group called sambashare by running

<syntaxhighlight lang="
 groupadd sambashare 
" enclose="none"></syntaxhighlight>


4. add your user to the group sambashare

<syntaxhighlight lang="
gpasswd -a %username% sambashare
(where %username% has to be replaced with your username)
" enclose="none"></syntaxhighlight>

5. run these three commands:

<syntaxhighlight lang="
 mkdir /var/lib/samba/usershares 
" enclose="none"></syntaxhighlight>


<syntaxhighlight lang="
 chgrp sambashare /var/lib/samba/usershares 
" enclose="none"></syntaxhighlight>


<syntaxhighlight lang="
 chmod 1770 /var/lib/samba/usershares 
" enclose="none"></syntaxhighlight>


4. add these at the end of the [Global] section in /etc/samba/smb.conf

<syntaxhighlight lang="
map to guest = bad user
usershare allow guests = yes
usershare path = /var/lib/samba/usershares
usershare max shares = 100
usershare owner only = false
username map = /etc/samba/smbusers 
" enclose="none"></syntaxhighlight>


5. make sure all entries in

<syntaxhighlight lang="
 /etc/samba/smbusers 
" enclose="none"></syntaxhighlight>

are commented out

6. For sharing folders in you home folder, make sure that the homefolder of the user is readable to others, otherwise samba can't make the folders there accessable.

7. run

<syntaxhighlight lang="
 rc-update add samba default 
" enclose="none"></syntaxhighlight>

so the samba daemon is startet on systemstart (only if samba is not running at startup, for ubuntu or debian this should not be needed, but for Sabayon this is necessary).

8. And as some people will experience that after reboot the nmbd is not started and the shares are not shown you can add to the

<syntaxhighlight lang="
 /etc/local.d/local.start 
" enclose="none"></syntaxhighlight>
this <syntaxhighlight lang="
 /etc/init.d/samba restart 
" enclose="none"></syntaxhighlight>

and if you still get problems using this you could try it with the sleep command to enshure that nmbd really can open a socketand if you still get problems using this you could try it with the sleep command to enshure that nmbd really can open a socket

<syntaxhighlight lang="
 /bin/sleep 20 && /etc/init.d/samba restart 
" enclose="none"></syntaxhighlight>

this lets the system wait for 20 seconds and then does the restart of the samba service. You should find out what is the best time youself, for me the 20 seconds are good working.

9. And the <syntaxhighlight lang="
 /etc/hosts 
" enclose="none"></syntaxhighlight>
should also be edited because the aliases are confusing smb.

So I changed it from

<syntaxhighlight lang="
 # IPv4 and IPv6 localhost aliases
127.0.0.1   localhost sabayon %computername%
::1      localhost sabayon 
" enclose="none"></syntaxhighlight>

to

<syntaxhighlight lang="
 # IPv4 and IPv6 localhost aliases
127.0.0.1   localhost
::1      localhost 
" enclose="none"></syntaxhighlight>

10. finally reboot, now you can use the foldersharing by rightclicking within Dolphin or Nautilus

Perhaps this should be implemented in Sabayon as default, so the user experience gets more comfortable.

greetings

maulbongo