PDA

View Full Version : Samba in fedora, how to set it up


KalasMannen
2005-10-13, 04:10 PM CDT
Hello!

I want to be able to share files between my fathiers windows computers running XP and my Linux computers running GNOME. I don't know how to set samba up, i want to be able to browse files on the toher computers, and set a "computername" instead of loaclhost.localhost. In short, i want to set a name for the linux computers and be able to share files, and maybe use the notwork printer we have.,..

Would be great if anyone could explaing these things to me... I've only used distros before that comes with samba comfigured for windows networking, so i didn't have to bother setting it up myself...


Thanks!

jim
2005-10-13, 05:01 PM CDT
i too could use some help in the samba world
Here is my /etc/samba/smb.conf

[global]
#======================= Global Settings =====================================
workgroup = MYHOMEPC
server string = Samba Server
hosts allow = 192.168.1. 127.
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
domain master = yes
preferred master = yes
dns proxy = no
os level = 65
#============================ Share Definitions ==============================
[homes]
comment = Home Directories
browseable = yes
writable = yes

[Shared]
comment = Shared file space
path = /home/Shared
read only = no
public = yes

[jimsdir]
comment = jim's home Folder
path= /home/jim
valid users = jim
public = no
writable = yes
browseable = yes


this is on my server that hosts my website as well. everything is behind a router. when attempting to browse my server in windows explorer \\Home\ get a the connection could not be found.
from my linux notebook i cannot connect as well.

this is run from the server ...

[root@Home ~]# smbclient -L MYHomePC
Connection to MYHomePC failed

jim
2005-10-13, 05:47 PM CDT
well I haven't gotten any further here...

scanned my open ports with nmap ..

07:44 PM[jim@Home ~]$ sudo nmap -sS 192.168.1.50

Starting nmap 3.93 ( http://www.insecure.org/nmap/ ) at 2005-10-13 19:44 EDT
Interesting ports on 192.168.1.50:
(The 1658 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
139/tcp open netbios-ssn
445/tcp open microsoft-ds
901/tcp open samba-swat
3306/tcp open mysql
5801/tcp open vnc-http-1
5900/tcp open vnc
5901/tcp open vnc-1
6001/tcp open X11:1

Nmap finished: 1 IP address (1 host up) scanned in 0.435 seconds
07:44 PM[jim@Home ~]$


the ones in Red are foer Samba... So what gives ???

pacifico
2005-10-13, 08:49 PM CDT
Do you know if stopping your firewall enables connections?
As root, try

/sbin/service iptables stop

and then try to connect again. If you still cannot connect, it is something else.

/sbin/service iptables start will bring your firewall back up.

I used the following script to allow connections on an FC3 samba server:

/sbin/iptables -N Samba-INPUT
/sbin/iptables -A Samba-INPUT -s 192.168.123.0/24 -i eth0 -p tcp -m multiport -m state --state NEW --destination-ports netbios-ns,netbios-dgm,netbios-ssn,microsoft-ds -j ACCEPT
/sbin/iptables -A Samba-INPUT -j RETURN
/sbin/iptables -I INPUT -s 192.168.123.0/24 -i eth0 -j Samba-INPUT

If it works, you can execute

/sbin/iptables-save > /etc/sysconfig/iptables

to make these changes the default after booting. It's always wise to save a copy of your previous configuration with

cp /etc/sysconfig/iptables /etc/sysconfig/iptables.orig

I also remember something about samba passwords which you'll need to sort out by googling. It's been a while since I set up samba, but it has run flawlessly and my windows XP home machine can browse a directory on the server fine.

As far as KalasMannen's post that started this thread, I'm not sure in which direction the browsing is going. I can share a smb.conf file, but as far as setting up a networked printer and browsing the windows machine from linux, I'm not much help there. I remember it took a while to sort this all out with online documentation, but it seemed that there was some good documentation on the printer thing.

HTH.
-al

KalasMannen
2005-10-14, 12:15 AM CDT
Well, i disabled my firewall on both machines adn now i can by typing smb://[computername] to be able to browse my windows machine. The problem is that it isn't, working the other way, it displays a computername, but its something like: localhost.localhost (samba), and i can't access it.

This is what i want to change, the name of the computer... And, i want to be able to access the linux box from the windows box. :rolleyes:

pacifico
2005-10-14, 12:40 AM CDT
My smb.conf is shown below with the lines numbered. This is done by nl /etc/samba/smb.conf and is for reference purposes only.

From windows, the names of the linux computer and the samba share are set by the smb.conf file. On my windows XP home machine, clicking on 'My Computer' shows the samba share as "music" (line 49 of smb.conf) and of the computer as "joplin" (line 6, maybe, case doesn't look the same... maybe not). You don't have a netbios name defined... try it and see if it changes what you see. You also have to map a drive letter to the samba share using the Tools menu of 'My Computer.'

You aren't being very specific about from where in Windows you're looking at the samba share, and that may be a clue.

You should also try restarting your linux firewall and then trying my iptables script above to permit access from windows. I don't know very much about the windows firewall, but my samba server is seen from windows and I don't recall any fiddling with the windows firewall.

I am a little rusty at the samba thing, basically lurking here hoping to get an anwer to my post from earlier this evening.

Hope this helps. I'm off to sleep here on the U.S. west coast.
-al

1 # This is Al's main samba configuration file
2 #
3 #======================= Global Settings =====================================
4 [global]
5 # Server's netbios name
6 netbios name = Joplin
7
8 # Belongs to same workgroup as laptop
9 workgroup = AL_AND_DINA
10
11 # With respect to workgroup name query service...
12 domain master = yes
13 preferred master = yes
14
15 # Limit access to machines on our LAN
16 hosts allow = 192.168.123.0/255.255.255.0
17 hosts deny = ALL
18
19 # Root user and wheel group are not allowed access
20 invalid users = root @wheel
21
22 # Alternative user names are in /etc/samba/smbusers
23 username map = /etc/samba/smbusers
24
25 # All our computers are Windows XP or Linux
26 lanman auth = no

27 # We don't have any OS/2 clients
28 lm announce = no
29
30 # Logs are written on a per-client basis
31 log file = /var/log/samba/%m.log
32
33 # We're still expecting errors, so we have detailed logging
34 log level = 3
35
36 # Don't let the log get too big
37 max log size = 50

38 # You may wish to use password encryption. Please read
39 # ENCRYPTION.txt, Win95.txt and WinNT.txt in the Samba documentation.
40 # Do not enable this option unless you have read those documents
41 encrypt passwords = yes
42 smb passwd file = /etc/samba/smbpasswd

43 # We provide netbios name resolution
44 wins support = yes
45
46 # Following options improve performance
47 socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

48 #============================ Share Definitions ==============================
49 [music]
50 comment = Music Collection
51 path = /srv/music/Music
52 force create mode = 0774
53 force directory mode = 0775
54 read only = no
55 guest ok = yes

pacifico
2005-10-14, 12:53 AM CDT
One more thing... I glanced at the samba home page and saw a link to http://www.reallylinux.com/docs/basicnetworking.html and to http://www.reallylinux.com/docs/sambaserver.shtml which are Fedora-specific samba set-up tutorials that focus on the GUI tools. I set mine up on a no-GUI server box directly editing the configuration files using vi, so I can't comment on how well these instructions work.

It looks like you maybe are beyond these, but they may help others reading the thread.
-al

KalasMannen
2005-10-14, 06:55 AM CDT
Thanks for all tips and help.

In windows i use to typ \\[COMPUTERNAME] in run dialog, but i also in the network/show workgroup. I've changed the samba workgroup setting to the same as the other mahcines in the network.

The firewall i use in windows is F-secure something. Apparently you have to disasble the firewall to be able to acess other computers, even between two windows machines... Probably has something to do with the rules in the firewall.

I'll try to change my Netbioas name an see what that does... Ill post here as soon as i've tryed it..

pacifico
2005-10-14, 08:04 AM CDT
You are doing the right thing by configuring this without the firewall and then adding the firewall as the last step. You are also right about using the same workgroup as the windows networking.

However, if you can't change the rules of your Windows firewall, you should get a different firewall, You shouldn't leave your windows machine without the firewall because the firewall won't let you do what you want. The firewall microsoft supplies is configurable using some dialog, but not as configurable as iptables.

For your windows firewall, be sure it allows outgoing UDP and TCP packets for the following ports from your Linux box:
137 (netbios-ns)
138 (netbios-dgm)
139 (netbios-ssn)
445 (microsoft-ds)

UDP and TCP refer to different ways of packaging the exchanged data and the ports refer to which service they are communicating about. These four ports are used for Microsoft networking. [While you're at itt, you should open port 22 (SSH) and install "PuTTY" on your windows box (google for it) to be able to log in to your linux box and use command line tools on it from the windows machine. Then you won't be walking about the house between two different computers to test configurations. If you don't know how to use vi, the University of Hawaii has an excellent on-line article about it. If you leave port 22 open all the time and the linux machine is accessible from the internet, you should disable root logins over ssh (easy to do in it's configuration file).]

A list of ports and the services they refer to is maintained at:
http://www.iana.org/assignments/port-numbers

As I understand it, you have never seen files on the linux machine from the windows machine. Once you've done the things you last mentioned, don't forget to 'Map network drive.' Then you should be able to click on that drive's icon and see what samba is sharing on the network.

-al

gavinw6662
2005-10-14, 05:51 PM CDT
also - when you installed fedora, did you set SElinux to be on?? The default install blocks smb from sharing 'home' directories. If you have the gui - go to systm settings, security settings, and scroll down the list of deamons, you will find the one for SAmba. Select the share home directoies one!