понеделник, 17 декември 2012 г.

How to start samba on Gentoo (successfully)

I never managed to run samba successfully but today, we had a break trough.
So, here's how to run samba on Gentoo
0. To install samba:
$sudo equo install samba
1. If you don't have a smb.conf then do
$sudo cp /etc/samba/smb.conf.default /etc/samba/smb.conf
2. Add to smb.conf:
usershare allow guests = Yes
usershare max shares = 100
usershare owner only = False
3. Do (following http://ryan.rawswift.com/2009/03/04/how-to-share-folders-in-linux-using-samba/):
$ sudo mkdir /var/lib/samba/usershares
$ sudo chgrp users /var/lib/samba/usershares/
$ sudo chmod 1770 /var/lib/samba/usershares/
4. Then all you need to do is restart samba.
$sudo /etc/init.d/smb restart

If you happen to prefer gui for samba, there is a way. (see http://en.gentoo-wiki.com/wiki/Samba#GUI_administration or http://www.gentoo-wiki.info/HOWTO_Setup_Samba#SWAT)
0. If samba doesn't start on reboot:
$sudo rc-update add samba default
1. $sudo equo install xinetd
2. $rc-update add xinetd default (optional)
3. $echo "net-fs/samba swat" >> /etc/portage/package.use (optional)
4. $sudo nano /etc/xinetd.d/swat
In it, make sure that you have:
service swat
port = 901
socket_type = stream
wait = no
only_from =
user = root
server = /usr/sbin/swat
log_on_failure += USERID
disable = no
Check that: "disable=no"!
6. Now you need a root password for samba
$smbpasswd -a root (for samba <3.4.6)
$pdbedit -a -u root
7. /etc/init.d/xinetd restart
8. To enjoy the gui, type in Dolphin or Konqueror or Nautilus:
If swat won't run, check your firewall settings.

After setting samba root password with "$smbpasswd -a root" we managed to mess the system root password (no idea how). To reset the root password, you can do:
$sudo su -
Now, your root login should work and everything should be peachy. If when accessing your samba folder, it asks you for a password, then use "root" and the password you set with $pdbedit -a -u root

Няма коментари:

Публикуване на коментар