LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   cifs share not listing any files? (https://www.linuxquestions.org/questions/linux-software-2/cifs-share-not-listing-any-files-803907/)

tomva 04-24-2010 02:08 AM

cifs share not listing any files?
 
Hello all-

I've got a Fedora 10 server with a simple read-only samba share.

I'm able to mount and browse the share from a Fedora 12 client, but all directories appear as empty--and I can see on the server that they contain many files. This happens whether I browse using smbclient, or mount using mount.cifs.

I've got smb/nmb ports enabled on both the client and server. File permissions on the server look right.

The server smb.conf setup:
Code:

[global]
        security = user
        passdb backend = tdbsam

[media]
        comment = Media Library (read-only)
        path = /media
        public = yes
        read only = yes

I can mount the share from the client, and browse using smbclient. However, all directories are empty (most contain between 1 and 10 files).

Any ideas what this could be? I don't see any errors in the server logs, even running at maximum log level.

Thanks!

-Thomas

irishbitte 04-26-2010 06:01 PM

can you give an example of what you have the unix permissions on files in the share looking like? This command should help:
Code:

ls -al /path/to/share/in/linux

tomva 04-26-2010 11:36 PM

Hello-

Thanks for the response!

On the server, this is the /media directory, off the root. Here is how that looks:
Code:

% ls -al /media
total 20
drwxr-xr-x  4 media media 4096 2009-11-14 05:09 .
drwxr-xr-x 22 root  root  4096 2010-04-24 00:10 ..
drwxr-xr-x  6 media media 4096 2010-03-22 20:16 audio
drwxr-xr-x 13 media media 4096 2009-11-14 05:13 photos

(and obviously, the . entry describes the /media folder permissions as seen from the root directory)

On the client, it looks like this:
Code:

% mount /mnt/media
% ls -al /mnt/media
drwxr-xr-x.  4 tomva tomva    0 2009-11-14 05:09 .
drwxr-xr-x.  5 root  root  4096 2010-04-23 22:19 ..
drwxr-xr-x.  6 tomva tomva    0 2010-03-22 20:16 audio
drwxr-xr-x. 13 tomva tomva    0 2009-11-14 05:13 photos

And here is the client fstab entry for /mnt/media:
Code:

% cat /etc/fstab | grep media
//server/media          /mnt/media              cifs    ro,guest,noauto,uid=500,gid=500 0 0


irishbitte 04-27-2010 07:07 PM

Just curious, can you take mount entry out of your fstab, and try doing this using smbclient? It might shed a little light on your situation.

jefro 04-27-2010 09:20 PM

Just wondering out loud. Does the directories have to have samba users as part of group that can read?

tomva 04-28-2010 12:39 AM

Hello all-

I appreciate the help! This is a strange one: I've gotten cifs mounts to work before, but this is strange behavior.

I've commented out the fstab entry, and used smbclient instead. I got the same behavior: I could navigate the directories, but they all showed zero files (even when I can see on the server that there are many files there).

For instance, I also run mediatomb on the same directory tree on the server, and it is able to find and expose all of the media files. I'm guessing my samba share is set up funky on the server.

Are there particular ports I should watch out for on the firewall? I ran system-config-firewall-tue on the server, and opened the standard samba ports.

-Thomas

irishbitte 04-28-2010 04:26 AM

is tomva part of the group media on the server?

tomva 04-28-2010 11:29 PM

Hello-

No, tomva isn't in the media group on the server. Although in the samba logs on the server it looks like the client is authenticating as user 'nobody', which I think makes sense for an anonymous public share.

-Thomas

tomva 04-28-2010 11:39 PM

Doh! I was just looking at the server logs again. I thought I had checked them before, but apparently either I didn't, or I hadn't checked them since bumping up the log level.

If I go to a particular directory in my media share (audio/Artists/Yello) that only contains one file, the directory listing (as seen on the client) looks empty. This is what I saw in the server logs when I ran that command:

Code:

[2010/04/28 21:31:47,  5] smbd/trans2.c:get_lanman2_dir_entry(1382)
  get_lanman2_dir_entry:Couldn't lstat [audio/Artists/Yello/Yello - Stella - 07 - Domingo.mp3] (Permission denied)

It is apparently getting a permission denied to even read the file. Even if I give the file full permissions for everyone (chmod 777) I still can't see it in the directory--and I don't want to give the world write permissions anyway!

According to the lstat() man page,
Code:

No permissions are required on the file itself, but — in the case of stat() and lstat() — execute (search) permission is required on all of the directories in path that lead to the file.
I've just checked: the world has execute permissions on everything in the media tree on the server! Any ideas what could be wrong?

irishbitte 04-30-2010 06:57 AM

Still not sure, there is perhaps something on your settings in smb.conf. Can you post it here, without all the extra stuff? Just the active lines.

tomva 05-10-2010 12:05 AM

Sorry for the delay! Got caught up in other things.

Here is my smb.conf file, from /etc/samba:

Code:

[global]
        workgroup = LakeHaven
        server string = Samba Server Version %v
        netbios name = julius

        # logs split per machine
        log file = /var/log/samba/log.%m
        # max 50KB per log file, then rotate
        max log size = 50
        log level = 5

        security = user
        passdb backend = tdbsam

        load printers = yes
        cups options = raw

[homes]
        comment = Home Directories
        browseable = no
        writable = yes

[printers]
        comment = All Printers
        path = /var/spool/samba
        browseable = no
        guest ok = no
        writable = no
        printable = yes

[media]
        comment = Media Library (read-only)
        path = /media
        public = yes
        read only = yes

[media-rw]
        comment = Media Library (writeable)
        path = /media
        public = yes
        writeable = yes
        valid users = media

As you can see, I've also got a writeable share (media-rw), but right now I'm just trying to get the read-only share to work.

Steveburner 05-10-2010 02:37 AM

Hi, i just want to know that tomva is part of the group media on the server

tomva 05-10-2010 10:21 PM

tomva is NOT a member of group media. Does that matter for the anonymous (read-only) share?

For the writeable share the client authenticates as user media.

irishbitte 05-11-2010 06:29 PM

well, are you trying to view both of these shares at the same time on one pc connected to the samba server? Because, it is only possible to pass one set of credentials to the server, not an individual set for each share. Does that make sense to you? So if you auth as user media, you will see the writeable share, but not the read only share, since both are mapped to the same backend directory: /media . If you auth as tomva, you should be able to see the read-only share. Does that help?

tomva 05-12-2010 12:08 AM

Quote:

So if you auth as user media, you will see the writeable share, but not the read only share, since both are mapped to the same backend directory: /media . If you auth as tomva, you should be able to see the read-only share.
I think that makes sense! However, I only connect to one share at a time, and for the read-only share my /etc/fstab is set up for me to authenticate as guest, not tomva.

From my /etc/fstab (on the client):
Code:

//julius/media          /mnt/media              cifs    ro,guest,noauto,uid=500,gid=500 0 0
(So I authenticate as a guest on the server, but the files are mapped to the local user tomva on the client). And I never set up user tomva for smb authentication on the server using smbpasswd, so I don't think I can authenticate as tomva.

On the server, it looks like I authenticate as user nobody (user ID 99) when I connect to the read-only share.


All times are GMT -5. The time now is 01:30 PM.