I'm having trouble getting samba sharing working to access shares.

I have setup a stand-alone box running Fedora 16 to use as a file-sharing and web development server. It needs to be able to share files with a Windows 7 PC and a Mac running OSX Snow Leopard.

I've setup Samba using the Samba configuration GUI tool on Fedora. Added users to Fedora and connected them as Samba users (which are the same as the Windows and Mac usernames and passwords). The workgroup name is the same as the Windows workgroup. Authentication is set to User. I've allowed Samba and Samba client through the firewall and set the ethernet to a trusted port in the firewall.

Both the Windows and Mac machines can connect to the server and view the shares, however when trying to access the shares, Windows throws error:

0x80070035 " Windows cannot access \\SERVERNAME\ShareName." 

Windows user is not prompted for a username or password when accessing the server (found under "Network Places"). This also happens when connecting with the IP rather than the server name.

The Mac can also connect to the server and see the shares but when choosing a share gives the error:

The original item for ShareName cannot be found.

When connecting via IP, the Mac user is prompted for username and password, which when authenticated gives a list of shares, however when choosing a share to connect to, the error is displayed and the user cannot access the share.

Since both machines are acting similarly when trying to access the shares, I assume it is an issue with how Samba is configured.



    workgroup = workgroup
    server string = Server
    log file = /var/log/samba/log.%m
    max log size = 50
    security = user
    load printers = yes
    cups options = raw
    printcap name = lpstat
    printing = cups

    comment = Home Directories
    browseable = no
    writable = yes

    comment = All Printers
    path = /var/spool/samba
    browseable = yes
    printable = yes

    comment = FileShare
    path = /media/FileServ
    read only = no
    browseable = yes
    valid users = user1, user2

    comment = Web development
    path = /var/www/html/webdev
    read only = no
    browseable = yes
    valid users = user1

How do I get samba sharing working?

UPDATE: I Figured it out, it was because I was sharing a second hard drive. See checked answer below.

Speculation 1: Before this box I had another box with the same version of fedora installed (16) and samba working for these same computers. I started up the old machine and copied the smb.conf file from the old machine to the new one (editing the share definitions for the new shares of course) and I still get the same errors on both client machines. The only difference in environment is the hardware and the router. On the old machine the router received a dynamic public IP and assigned dynamic private IPs to each device on the network while the new machine is connected to a router that has a static public IP (still dynamic internal IPs though.) Could either one of these be affecting Samba?

Speculation 2: As the directory I am trying to share is actually an entire internal disk, I have tried these things:

1.) changing the owner of the mounted disk from root to my user (which is the same username as on the Windows machine)

2.) made a share that only included one of the folders on the disk instead of the entire disk with my user again as the owner.

Both tests failed giving me the same errors regarding the network address.

Speculation 3: Whenever I try to connect to the share on the Windows 7 client I am prompted for my username and password. When I enter the correct credentials I get an access denied message. However I did notice that under the login box "domain: WINDOWS-PC-NAME" is listed. I believe this could very well be the problem.

Speculation 4: So I've completely reinstalled Fedora and Samba now. I've created a share on the first harddrive (one fedora is installed on) and I can access that fine from Windows. However when I try to share any data on the second disk, I am receiving the same error. This I believe is the problem. I think I need to change some things in fstab or fdisk or something.

Speculation 5: So in fstab I mapped the drive to automount in a folder which works correctly. I also added the samba_share_t SElinux label to the mountpoint directory which now allows me to access the shares on the Windows machine, however I cannot see any of the files in the directory on the windows machine. (They are there, I can see them in the fedora file browser locally)


Finally got it. So first off the problem was with the fact that I was trying to share a second harddrive, instead of data on the same drive that the os was installed on. Here are the steps to be able to share a second drive over Samba: (These are for an internally mounted drive, but I think it may also work for externals)

1.) You must setup the drive to automount in fstab. add:

/dev/sdbx /mountpoint ext3 auto 0 0

to /etc/fstab where x is the partition number for the drive, "/media/mountpoint" is the mount directory (I created a directory called /share and mounted the drive there) and "ext3" is the filesystem

2.) set the permission for the mount point to 755:

chmod 755 /mountpoint

3.) Add a new SElinux label "samba_share_t" and apply this label to the mountpoint

chcon -t samba_share_t /mountpoint

4.) Apply these permissions to all enclosed files and folders. (I used Gnome's GUI for this)

I can access read and write to the share from both a Windows 7 PC and a Mac running OSX.


Post your smb.conf, so we can check if all your configuration is ok.

The most important part of your smb.conf is something like this:

   valid users = user1 user2    #you can use groups
   public = no
   path = /var/www    #the path of your folder
   printable = no
   writable = yes

Remember run smbpasswd for each user to generate the Samba Password.

Another important thing... restart Samba. :P

  • cyberciti.biz/tips/… also set "read only = no" just in case. – Richard Jun 4 '12 at 19:51
  • smb.conf added to question – biggles Jun 4 '12 at 19:53
  • I always restart samba after I make changes to the config, still nothing. – biggles Jun 5 '12 at 14:52
  • @Richard read only is set to no for all shares – biggles Jun 5 '12 at 17:36

make sure you can see samba running using netstat

netstat -an | grep LISTEN | egrep "445"

also try adding interface binding into the config:

interfaces = eth0 or interfaces = <ip address> in smb.conf

  • Not sure exactly what the output of that command should be? Also tried adding the interfaces to the config with no luck. (tried adding many different combinations of IP and interfaces and nothing.) – biggles Jun 5 '12 at 14:54
  • Samba should be listening on port 445, port 139 is legacy. Since you can connect and see the shares (and just not the contents of them) this answer doesn't apply particularly well in your case. – Tim Brigham Jun 5 '12 at 15:55

I was having the same trouble, finally I could solve it, editing /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled    # if the files dont appears is because this parameters is not disabled
  • 1
    This disables all SELinux security, something you should never do under normal circumstances. This is not only a bad idea but potentially opens the server to malware. – Chris S Jun 2 '14 at 20:59
  • This will solve the problem yes. I had SELinux issues as well, but as Chris says, this disables ALL security and can be a security risk if this box is connected to the internet. – biggles Jun 3 '14 at 15:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.