Knowledge Base
Searching in : Article
ID: AR07E00478
Applies to: NX Server Products
Added on: 2007-07-18
Last Update: 2013-10-14

What to do when getting Permission denied error when trying to access shares mounted within the NX 3.5.0 session

When the share is exported by NX Client 3.5.0 running on Linux, it may occur that, even if the share appears to be mounted correctly inside the session, it isn't accessible. In this case, you get a dialog in the NX session which informs you that shares have been mounted, for example:

SMB share '//mymachine/nxtest01' mounted on
'/home/nxtest/MyShares/nxtest01'.

But when you try  to list content of the share mounted within the NX session, you can get an error similar to the following:

nxtest@servermachine:~>  ls -l  /home/nxtest//MyShares/nxtest01
ls: cannot open directory ./home/nxtest//MyShares/nxtest01: Permission denied

When this issue occurs, it is likely that the mount has been launched by Samba under a certain uid, for example 1000 (which is the uid of the user on the client side), but happens to not be the uid of user nxtest on the server side.

This issue occurs because, even if the node specifies the uid option when running the mount.cifs command, this option is ignored when the target server supports the CIFS Unix extensions. This is the intended behaviour of the CIFS implementation. As stated at:

http://samba.org/ftp/unpacked/cifsvfs/fs/cifs/README

CIFS VFS Mount Options
[...]
For mounts to servers which do support the CIFS Unix extensions, such as a properly configured Samba server, the server provides the uid, gid and mode.

Suggested workarounds

In order to solve this issue, you may apply any of the following workarounds.

  1. Ensure that the same uid is used on server and client side.
  2. Disabe CIFS Unix extensions on server side by running from a
    console or similar:

    # echo 0 > /proc/fs/cifs/LinuxExtensionsEnabled

  3. Disable CIFS Unix extensions on client side by adding the following line
    to [global] section of smb.conf:

    unix extensions = no

    and restart samba.

Please note that in case of workarounds 2 and 3, all files in the mounted share will be owned by the target user, but can be readable and writable by everybody.
Since NX node sets restrictive permissions to the MyShares directory, the mounted share will be accessible only by the target user.