Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Unable to access mounted NAS

  1. #1
    Join Date
    Oct 2021
    Beans
    11

    Unable to access mounted NAS

    In /etc/fstab
    //192.168.1.125/home /home/fckwan/MyNAS1 cifs username=fckwan,password=<NAS password>,noperm,dir_mode=0777,file_mode=0777,ioch arset=utf8,_netdev 0 0

    ls -alg fstab
    -rw-rw-rw- 1 root 1144 Oct 13 10:55 fstab
    Then I reboot the machine.
    I then try to access the newly mounted /home/fckwan/MyNAS1

    But I will see the following error :
    mount: /home/fckwan/MyNAS1 : operation permitted for root only.
    I log in as fckwan as an administrator.

    What should I do to allow fckwan (a admin user) to access the mounted drive. I don't want to log in as root all the time.
    As I don't know the root password.
    Attached Images Attached Images

  2. #2
    Join Date
    Dec 2009
    Beans
    6,576

    Re: Unable to access mounted NAS

    I think what is happening is that during the boot process the instructions in fstab are being executed before the networking stack is fully operational so the cifs mount fails and _netdev isn't enough to fix this.

    You have two options:

    [1] Change your existing fstab declaration but add 2 more options: noauto,user
    Code:
    //192.168.1.125/home /home/fckwan/MyNAS1 cifs  username=fckwan,password=<NAS  password>,noperm,dir_mode=0777,file_mode=0777,ioch arset=utf8,_netdev,noauto,user 0 0
    noauto = will make it so it doesn't try to mount at boot time.
    user = allows a mount by an ordinary ( non root ) user.

    [2] A systemd automount - adding noauto,x-systemd.automount to the list of options.

    The problem here is that you will need to change your mount point to something other than your home directory or under /media. So you create a mount point under /mnt for example and fstab would look something like this:
    Code:
    //192.168.1.125/home /mnt/MyNAS1 cifs  username=fckwan,password=<NAS  password>,noperm,dir_mode=0777,file_mode=0777,ioch   arset=utf8,_netdev,noauto,x-systemd.automount 0 0
    Either way you should do the systemd 2-step after editing fstab to make sure your system is happy:
    Code:
    sudo systemctl daemon-reload
    sudo systemctl restart remote-fs.target
    Last edited by Morbius1; October 15th, 2021 at 01:19 PM.

  3. #3
    Join Date
    Oct 2021
    Beans
    11

    Re: Unable to access mounted NAS

    Option 1. The error message "mount: /home/fckwan/MyNAS1 : operation permitted for root only." no longer come up.This is some improvement.
    But nothing is in the folder. It is suppost to have a lot of files and directories there.

    Option 2, When I try to access the /mnt/usbshare2 ( or other drive) it say " bash: cd: usbshare2: No such device"

    The following is the sample line in /etc/fstab
    //192.168.1.125/usbshare2 /mnt/usbshare2 cifs username=fckwan,password=<NAS Password>,noperm,dir_mode=0777,file_mode=0777,ioch arset=utf8,_netdev,noauto,x-systemd.automount 0 0

    I restart the machine after changing the fstab entries.

    I attached the related screen shots for your reference.
    Attached Images Attached Images

  4. #4
    Join Date
    Dec 2009
    Beans
    6,576

    Re: Unable to access mounted NAS

    *** Create a mount point:
    Code:
    sudo mkdir /Temp
    *** Do a temporary mount in verbose mode to see if there are any errors:
    Code:
    sudo mount -t cifs -vvv //192.168.1.125/home /Temp -o username=fckwan,password=<NASpassword>,noperm,dir_mode=0777,file_mode=0777
    Check the permissions of /Temp and it's contents.

  5. #5
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Unable to access mounted NAS

    Mounting CIFS or NFS storage underneath a HOME directory is asking for problems. Mount the storage elsewhere, then use a symbolic link to make access from HOME easier. Just a few weeks ago, someone else in these forums had all sorts of issues and wasted a few weeks of time trying to solve a problem - that turned out to be caused by mounting storage under his HOME. Just don't do that and avoid those future issues now.

    After you get the cifs mount command working in a temporary area, it is best to have a credentials file to put the CIFS credentials inside, so the entire world cannot see them in the fstab or in the process list. Also, permissions of 777 are a terrible idea and should be tightened up ASAP. I get they are tempting.

  6. #6
    Join Date
    Oct 2021
    Beans
    11

    Re: Unable to access mounted NAS

    I changed the command to only -v instead of -vvv:
    sudo mount -t cifs -v //192.168.1.125/home /Temp -o username=fckwan,password=<NAS password>,noperm,dir_mode=0777,file_mode=0777
    created /Temp and changed permission
    drwxrwxrwx 2 root 4096 Oct 17 15:57 Temp
    The mount command above results in:
    mount: /Temp: cannot mount //192.168.1.125/home read-only.

    My Ubuntu is run within Virtual Box. Will it affect the result.
    My NAS is just a Synology ds120j attached to the home network.It work in the Windows 10 system that host the virtual box without any problem.

  7. #7
    Join Date
    Dec 2009
    Beans
    6,576

    Re: Unable to access mounted NAS

    This would be a lot easier if I had your NAS since I've never seen your combination of error messages before.

    All the usual suspects would result in a different error message:

    I would just go through the checklist while I try to reproduce your errors on a standard Debian server:

    ** Make sure cifs-utils is installed:
    Code:
    sudo apt install cifs-utils
    ** I would replace noperm with nounix:
    sudo mount -t cifs -v //192.168.1.125/home /Temp -o username=fckwan,password=<NAS password>,nounix,dir_mode=0777,file_mode=0777
    ** I would make sure DSM on the synoloy had the max server SMB set to SMB3

    As far as VirtualBox the default Network Adapter setting is NAT. For this situation that would be fine but it means that your Ubuntu machine can access others on the LAN but they cannot access you. If you want this Ubuntu machine to be a full member of the LAN you should set this to "Bridge Adapter"

  8. #8
    Join Date
    Oct 2021
    Beans
    11

    Re: Unable to access mounted NAS

    I installed cifs-utils
    I ran the following command.
    sudo mount -t cifs -v //192.168.1.125/home /Temp -o username=fckwan,password=<NAS Password>,nounix,dir_mode=0777,file_mode=0777
    mount.cifs kernel mount options: ip=192.168.1.125,unc=\\192.168.1.125\home,nounix,d ir_mode=0777,file_mode=0777,user=fckwan,pass=***** ***
    mount error(13): Permission denied
    Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)

    dmesg log
    [ 718.245913] FS-Cache: Loaded
    [ 718.479747] FS-Cache: Netfs 'cifs' registered for caching
    [ 718.530011] Key type cifs.spnego registered
    [ 718.530070] Key type cifs.idmap registered
    [ 718.536526] CIFS: No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3.1.1), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3.1.1 (or even SMB3 or SMB2.1) specify vers=1.0 on mount.
    [ 718.536535] CIFS: Attempting to mount \\192.168.1.125\home
    [ 720.115790] CIFS: Status code returned 0xc000006d STATUS_LOGON_FAILURE
    [ 720.115838] CIFS: VFS: \\192.168.1.125 Send error in SessSetup = -13
    [ 720.115898] CIFS: VFS: cifs_mount failed w/return code = -13

    My NAS Password contains special character . E.g., $, @^&!#%*, number, upper and lower case characters etc. Do I need to enclose the password in "" or ''?

  9. #9
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Unable to access mounted NAS

    A command line gets interpreted by the shell. Many "special characters" have special meaning to the shell, so quoting is the minimal you should do. Using a credentials file would be even better for the options. As in :
    Code:
    credentials=/root/win7lap.credentials
    Just be certain to place it somewhere that only root has access and no other userids can read.

    The format of that file is:
    Code:
    username=thefu
    password=4sklfg92s,&4,l@!#!!!kldsdf87b,
    No spaces. The first '=' is the delimiter between the key and the value for the key.

    BTW, appears your NAS is running a very, very, old version of SAMBA. You need to patch/upgrade it based on this error:
    Code:
    [ 718.536526] CIFS: No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3.1.1), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3.1.1 (or even SMB3 or SMB2.1) specify vers=1.0 on mount.
    Newer CIFS will negotiate reasonable versions. Any version older than Win7 is considered unreasonable and needs a manual option. But just update the NAS software and that should go away. About a year ago, almost all typical HOME NAS devices had some pretty serious remote attack problems, so everyone should have patched then.

    So see the specific version of CIFS that your NAS is offering ...
    Code:
    sudo nmap --script smb-protocols 192.168.22.14
    On my Ubuntu 18.04 CIFS server, I see:
    Code:
    ....
    Host script results:
    | smb-protocols: 
    |   dialects: 
    |     2.10
    |     3.00
    |     3.02
    |_    3.11
    Morbius1 taught me that nmap command. Quite handy.

  10. #10
    Join Date
    Dec 2009
    Beans
    6,576

    Re: Unable to access mounted NAS

    If the ultimate goal is to create an fstab declaration the best approach is the credentials file that TheFu suggested. In fstab all these special characters would have to be converted so the system can interpret them correctly.

    For example if the password is my password the fstab entry would have to be my\040password. Each special character has it's own code and it would be a burden to convert them all without making some kind of typo. Here is a list to show you what I mean: https://www.asciitable.com/ You don't have to convert all of those characters but the special one's like #, $, etc have to be converted. Having it unconverted in the credentials file is easier.

    [ 718.536526] CIFS: No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3.1.1), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3.1.1 (or even SMB3 or SMB2.1) specify vers=1.0 on mount.
    If your NAS doesn't support SMB2.1 or above you need to do what the caution suggests by adding to your mount / fstab statement one of the following:

    Code:
    vers=1.0
    
    vers=1.0,sec=ntlm
    
    vers=2.0
    EDIT: Forgot that we are talking about a Synology NAS. Those are fairly sophisticated so unless you haven't updated your software in years I suspect it is already set to a max value of SMB3 but you should check it as I suggested in my previous post. The dmesg message is more a statement of fact rather than an actual error: "We are going to use SMB2.1 through SMB3 unless you specify otherwise...."
    Last edited by Morbius1; October 19th, 2021 at 01:59 PM.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •