LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   samba does not work (https://www.linuxquestions.org/questions/linux-newbie-8/samba-does-not-work-629678/)

jianght 03-21-2008 12:14 PM

samba does not work
 
Hi,
I installed samba on centos4 for AMD Opteron machine. I checked
service smb status:
smbd (pid 22145 22141) is running...
nmbd (pid 22147 22146) is running...
But when I tried to connect it from window side by
\\192.168.0.100
it says:
the network path was not found
But I can ping that machine and ssh to that machine.

Another strange things is that I don't see /etc/samba/smbpasswd

Your help is greatly appreciated!
Best,
Alfred

rajeshkerala 03-21-2008 02:49 PM

hope u had done this..
vi /etc/samba/smb.conf

[global]
workgroup=<workgroup name of the windows computer>

jianght 03-21-2008 04:22 PM

Hi,
I just use MYGROUP.
BTW, somehow, when I use smbpasswd, I don't see anything changes in smbusers file. Besides, I cannot find smbpasswd file.
Best,
Alfred

Jayla 03-21-2008 05:49 PM

Hi Alfred

I have recently setup samba myself, I followed the guide linked below and it worked a charm with no issues!

http://ubuntuforums.org/showthread.php?t=103328

Hope this helps

jianght 03-22-2008 12:51 AM

Hi,
Thanks. What is netbios name? Is it machine's ip address or just hostname?
Best,
Alfred

townie 03-22-2008 01:03 AM

hi
the netbios name is not hte ip address or the hostname is similar to the hostname there a link below to wikipedia that cna explain the diffenrcehttp://en.wikipedia.org/wiki/NetBIOS_name#Name_service

:)

jschiwal 03-22-2008 03:02 AM

The "smbpasswd" file should be in /etc/samba/. If it isn't there, did you run
smbpasswd -a <username>
password

The samba package supplies the html version of the "Using Samba 2nd Edition" book. Look in /usr/share/samba/.
Either the samba package or a samba-doc package supplies a number of manpages, sample configurations and the books: Samba 3 by Example & Samba 3 HOWTO and Reference. These books will take you step by step on various types of configurations including what ownership & permissions to use on certain types of shares. For example for a world writable share, use the same permissions that are used for the /tmp directory:
sudo mkdir /srv/samba/public
sudo chmod a=rwxt /srv/samba/public

---

Your problem of the service or the host not showing up in the Network Neighborhood browser could be due the ports 137 and 445 being blocked at either the server or the client. Some older windows clients use ports 137-139.

Also consider using "wins support = yes" on the server, and then enter your server's IP address in the WINS entry of your DHCP NAT router if you have on. This will reduce the broadcast traffic on your network and network browsing may function better. Don't use this option if you already use a WINS server. You can only have one Samba WINS server per subnet.

---

Using samba swat can also simplify setting up a samba server. see "man 8 swat".
First you need to enable it in the /etc/xinet.d/swat configuration file. Change the line "disable = yes" to "disable = no".
Then make sure that xinet.d is running: "sudo /sbin/chkconfig swat on"
Restart the xinetd service: "sudo killall xinetd"
Then in your web browser, browse to "http://localhost:901"

jianght 03-22-2008 08:52 PM

Hi,
Thanks a lot. I tried those tricks but it did not work.
Here are some extra facts:
1) hostname : tt0.uuart.com
2) lmhosts: 127.0.0.1 localhost
3) the local IP address for that machine is 192.168.0.100
4) in smb.conf
I have not specified netbios name. I am wondering what it should be.
5) [root@tt0 samba]# nmblookup -B chelsea _SAMBA_
querying _SAMBA_ on 127.0.0.1
name_query failed to find name _SAMBA_

In my case, it is just local network. the I don't have DNS server and tt0.uuart.com is just a name I put when set up the machine.
Before, when it is localhost.localdomain. It works.
Thanks a lot,
Best,
Alfred

jschiwal 03-22-2008 09:14 PM

Enter in the "hostname" command. It should respond with the hostname portion (without the domain name part). I think it will be tt0. The domainname command on the other hand will return the NIS domain name and not the FQDN domain portion. Might as well use the same name for your netbios hostname. If your /etc/nsswitch.conf file contains an entry for either wins, winbind or if your NAT router is used as a DNS address and /etc/nsswitch.conf contains a "dns" entry in the "hosts:" line, then I think they must be the same. So while you mentioned that you don't run a DNS server, some NAT routers do provide a local DNS server and hosts that use DHCP will have the router address used as one of the three DNS entries in /etc/resolv.conf. I think this would mandate having the hostname be the same for the netbios name and the hostname part of your FQDN that you used in /etc/hosts.

You were correct in changing "localhost.localdomain". Another host trying to reach you by that name would reach itself instead. I think the point of having that at the start is so that you don't have several hosts on the network with default names that are real hostnames.

I use "hpamd64.jesnet" in /etc/hosts for my laptop and "hpmedia.jesnet" in /etc/hosts for my desktop. They also have alias entries in /etc/hosts hpamd64 & hpmedia respectively. I also have an entry in /etc/network for jesnet.

Code:

getent hosts hpamd64
127.0.0.2      hpamd64.jesnet hpamd64
jschiwal@hpamd64:~> getent hosts hpmedia
192.168.1.105  hpmedia.jesnet hpmedia
jschiwal@hpamd64:~> getent networks jesnet
jesnet                192.168.1.0

From /etc/hosts on hpamd64:
Code:

192.168.1.105  hpmedia.jesnet hpmedia
I didn't use a .net or .com because I don't have a fixed internet address. If I did I probably wouln't be able to just make up a network name. The network name shows up in things like the output of the "route" command which makes it more readable.

jianght 03-23-2008 09:15 PM

Hi,
Thanks for so much on those information. One question, when I tried to access from window side, I always use ip address: 192.168.0.100. In this case, why do I need netbios name?
Besides, I checked nsswitch.conf file:
passwd: files
shadow: files
group: files
Should I change it as somebody mentioned through google search?
passwd: files wins
shadow: files wins
group: files wins
From what you said, it looks like I have to modify my machine's name.I tried to change it back to localhost.localdomain. It does not work anymore for samba. I used to use centos5 and now I am using centos4. I should have written all those info down.
Best,
Alfred

billymayday 03-23-2008 09:27 PM

Did you try without SELinux running?

setenforce 0

and setenforce 1 to turn it back on

jschiwal 03-23-2008 09:55 PM

Don't change it back to localhost.localdomain. That is just wrong. What did "hostname" return. Might as well use that. Fedora Core has the hostname set in /etc/sysconfig/network. "HOSTNAME = <yourhostname>". The part before the dot (.) is used as the hostname. Your original hostname (tt0.uuart.com) has a hostname part (tt0) and a domain name part (uuart.com). Where did the uuart.com come from? If you just made it up, maybe drop the .com because "uuart.com" isn't an internet domain. ( As I stated before, uuart.com isn't the "domainname" because "domainname" returns the NIS domain, and since you aren't using NIS you don't have one.)

I have FC6 on an old (Pentium III) dell laptop. Here are my /etc/sysconfig/network's HOSTNAME & /etc/networks files:
Code:

HOSTNAME = delllap.jesnet
 
jschiwal@lmac:~> cat /etc/networks
#
# networks      This file describes a number of netname-to-address
#              mappings for the TCP/IP subsystem.  It is mostly
#              used at boot time, when no name servers are running.
#

loopback        127.0.0.0
link-local      169.254.0.0
jesnet          192.168.1.0


For entries in /etc/nss_switch there will be a cooresponding library file needed. For example if you have a dns entry make sure there is a libnss_dns library installed. It will probably be from a package by the same name.

Code:

/lib/libnss_compat-2.6.1.so
/lib/libnss_compat.so.2
/lib/libnss_dns-2.6.1.so
/lib/libnss_dns.so.2
/lib/libnss_files-2.6.1.so
/lib/libnss_files.so.2
/lib/libnss_hesiod-2.6.1.so
/lib/libnss_hesiod.so.2
/lib/libnss_ldap.so.2
/lib/libnss_mdns.so.2
/lib/libnss_mdns4.so.2
/lib/libnss_mdns4_minimal.so.2
/lib/libnss_mdns6.so.2
/lib/libnss_mdns6_minimal.so.2
/lib/libnss_mdns_minimal.so.2
/lib/libnss_nis-2.6.1.so
/lib/libnss_nis.so.2
/lib/libnss_nisplus-2.6.1.so
/lib/libnss_nisplus.so.2
/lib/libnss_winbind.so.2
/lib/libnss_wins.so.2

If you have an "avahi" (zero config) daemon running, then install the "libnss_mdns4_minimal" and "libnss_dns" libraries and use:
Code:

hosts:          files mdns4_minimal [NOTFOUND=return] dns
This may have more to do with having hosts show up in Linux however.

The "libnss_winbind" corresponds with a winbind entry in nsswitch.conf and libnss_wins with a wins entry.

If you used "wins support = Yes" in your smb.conf, make sure that both the smbd and nmbd daemons are running. If you have users in windows who aren't Linux users, running the winbind daemon may help aleviate the need to map bad users to guest for public shares.

Also use nmap or another port scanner on another computer and determine if ports 139 & 445 are open.

Also run the "firewall & security" config. There is a tab for selinux. Look under samba and see what it says. Billymayday's tip is to disable selinux completely temporarily as a troubleshooting technique. I think you need to reboot after using the "setenforce" command.

Also look in the "Samba 3 HOWTO & Reference" document. I think there is a troubleshooting section that deals with browsing.

Another thing to consider is to set up samba using swat.
A) edit /etc/xinet.d/swat. Edit the "disable = yes" line to "disable = no" line.
B) if xinetd is running, restart it with "sudo killall xinetd"
C) if xinetd is not running start it with "sudo /sbin/service xinetd start" or "sudo /sbin/chkconfig xinetd on"
D) Point your web browser to "http://localhost:901"

The html version of the books I mentioned will be available on the bottom of the intro page.


Also make sure that none of the windows clients have an unused protocol installed such as IPX support. This will cause that host to always be elected as the master browser. If that host has a problem then browsing might not work well.

You might as well post your /etc/samba/smb.conf file. Maybe someone will notice something there.

Start with giving this host a normal hostname and rebooting. Then see if browsing on the Windows hosts starts working.

jianght 03-24-2008 12:24 AM

Hi,
Thanks again. I tried SElinux option, it is the same. Then I tried to reset IP address from 192.168.0.100 to 192.168.0.110 and restarted my samba. Then I found this issue:
smbclient -L tt0
Error connecting to 192.168.0.100 (No route to host)
Connection to tt0 failed
Why is it still 192.168.0.100?
I can ssh to this machine through 192.168.0.110. I think this might be reason. Because I reset this machine to centos4. I setup samba using 192.168.0.100 with centos5 for a while for this machine. I think it is confused for some reason.
Now the question is how I can make sure smbclient to choose the new IP or local host?

Best,
Alfred

jschiwal 03-24-2008 01:58 AM

If you changed your IP address, then edit any /etc/hosts files to reflect the change.

jianght 03-24-2008 12:04 PM

Hi,
my /etc/hosts has only one line
127.0.0.1 tt0 localhost.localdomain localhost
Should I remove tt0?
But I don't understand how smbclient decides to use 192.168.0.100?
Best,
Alfred


All times are GMT -5. The time now is 04:53 AM.