Problems auto-mounting samba/cifs share with fstab

8,966

I think your box is having difficulty resolving the IP of freenas via wins/netbios. Sometimes it is very difficult to resolve.

  1. In your /etc/fstab, use ip address instead of hostname like following

     //192.168.1.100/Server
    
  2. In your /etc/hosts, add following line

     192.168.1.100    freenas
    
  3. /etc/fstab, use credential

     //freenas/Media /home/charles/Server cifs defaults,uid=1000,username=<user>,password=<pass> 0 0
    
Share:
8,966

Related videos on Youtube

charels88
Author by

charels88

Updated on September 18, 2022

Comments

  • charels88
    charels88 over 1 year

    I have been following the same tutorial that everyone else is referencing. My fstab entry is exactly like in the tutorial with changes to actual location. I keep getting the error

    mount: only root can mount //freenas/Server on /media/Server
    

    This is the most irritating thing I run into time and time again with running Ubuntu. I have had a freeNAS box with a single hard drive in it for almost 4 years. I had my server mounted correctly a month ago but I started from scratch again.

    The server is functioning normally as I have another Ubuntu box running XBMC perfectly fine.

    I am running Ubuntu 12.10 but get the same message with 12.04.

    I have installed cifs-utils and smbnetfs from terminal after installing samba from the software center. This is how I got it running last time.

    The workgroup in samba matches my network workgroup.

    I don't have any credentials to check with the share as it is setup as guest.

    I can't browse the network as it keeps giving me a timeout error. I also can't open my share from Nautilus by hitting Ctrl+L and manually typing my server share (//freenas/Server).

    Edit 1: I'm able to browse my network but still am getting the error message?

    Edit 2: I'm able to mount the share after testing the individual options one my one. It seems that using codepage=unicode was causing the problem. My fstab entry now looks like:

    //freenas/Media /home/charles/Server cifs guest,iocharset=utf8,uid=1000 0 0

    Edit 3: I can only mount using only "guest" for options? Last time I ran into an issue of not being able to open files on other computers that originated from my Ubuntu machine?

    Last Edit: I had to force my freeNAS server(Version: 0.7.2.5543) to have the same permissions as Ubuntu, GID=1000 for uid=1000. Also freeNAS by default creates a guest user account ftp with a null password. With these three items and adding my freeNAS IP address to /etc/hosts I'm up and running. Sorry for the super long delay closing this question but I greatly appreciate the help!

    fstab entry: //freenas/Media /home/charles/Server cifs username=ftp,password=,uid=1000 0 0

    • Bruno Pereira
      Bruno Pereira over 11 years
      Start by actually showing the line you are using to mount the share with fstab and the output of ls -l in /media.
    • charels88
      charels88 over 11 years
      //freenas/Media /media/Server cifs guest,uid=1000,iocharset=utf8,codepage=unicode,unicode 0 0
    • John Siu
      John Siu about 11 years
      In your edit 2, is uid1000 a typo here or a typo in your actual fstab? It should be uid=1000.
    • charels88
      charels88 about 11 years
      It was just a typo here John I will fix it, Thanks.
  • charels88
    charels88 over 11 years
    I'm out of town but will try this when I get back.
  • charels88
    charels88 about 11 years
    I have tried both options John but have had no success. From a stroke of luck I'm able to now browse my network and can see and use my server. Any other suggestions to auto-mount the share?
  • John Siu
    John Siu about 11 years
    If you are trying to mount from Nautilus, maybe try comment/remove the line from /etc/fstab.
  • charels88
    charels88 about 11 years
    I'm trying to auto-mount using fstab but can mount only if I have "guest" for options
  • John Siu
    John Siu about 11 years
    Did you setup your freenas with guest only access? Or you want to connect with credential? Check (3).
  • charels88
    charels88 about 11 years
    FreeNAS is set up to give anonomyous(guest) access. I'm having an issue that files I upload can be read but not changed even from the desktop I uploaded them with??? I thing that this is because I have only guest as options. I can't make heads or tails from the man pages on how to properly configure fstab. If you know of a good tutorial or another reference that better explains the mount configurations please share.
  • John Siu
    John Siu about 11 years
    I believe we will have to solve the issue from the freenas side. Is it possible you change the share directory owner on freenas to a uid=1000?
  • charels88
    charels88 about 11 years
    This is where it gets muddy, my freenas box is a lga755 pentium 4 and has an outdated version of freenas that I'm unable to update due to compatability. I'm not that great with the server side of things as I can set up the box for samba but the advanced settings are lost on me. The only thing on the freenas side I can tell that might help is that the default guest account name is "ftp". I will try removing the "guest" option in fstab to replace with "user=ftp,password=". I will continue to research how to set "uid=1000" on the server side.