I've got a windows system running centos inside a virtual box vm.

I have a directory I've shared in windows, and mounted from centos, in fstab, like so:

//<ip address>/head_build  /mnt/company-build  cifs  user,uid=0,gid=0,rw,auto,exec,suid,username=uname,password=pword,iocharset=utf8 0 0

In a subfolder, I have a script. If I try to run it, I get the error 'bad interpreter', which I believe is fixable with dos2unix.

However, I can't seem to do anything to this script. dos2unix says Failed to open output temp file: Permission denied.

chmod and chown also say permission denied. lsattr says 'Inappropriate ioctl for device while reading flags'.

Edit: I am logged in as root in the centos machine. The shared folder in windows has granted access to everyone to do everything (the user from the mount also has permissions on the folder in windows).

Edit 2: I've tried adding file_mode=777, dir_mode=777 (as suggested in comments), as well as umask=777 and noperm (thought that one would do it), but no luck.

Edit 3: After chatting with S19N, I'm in agreement the problem seems to be on the server side of the mount, ie, windows. But the shared folder has every permission I can think of. Is there some secret sauce for getting execute permissions from a cifs mount into windows?

Edit 4: Here is the output from calcs for the directory I have shared on windows:

c:\company\builds\head>cacls build
c:\company\builds\head\build computer-name\uname:(OI)(CI)F
                            NT AUTHORITY\SYSTEM:F
                            NT AUTHORITY\SYSTEM:(OI)(CI)(IO)F

This would seem to show that this folder, when mounted, would allow all permissions.

Edit 5: Based on Jim's comment, I checked net session, on the windows box, to see what I was connected as from the mount. When I tried to run the net session command with my uname account (the one I am using to mount), I got access-denied.

When I used run as administrator, I could see that I was accessing the mount with the uname account. I disabled UAC on the uname account (UAC being the system in windows 7 that asks you if you want to allow certain actions to proceed). This actually allowed the uname account to run net session without error.

However, the uname account is still unable to do anything from the mount: touch: cannot touch 'test': Permission denied

Edit 6: I just activated the true administrator account on the windows box (as described here), and used that as the user for the mount. Thought that would do it. Still get permission denied from inside the mount.

On a whim, I also tried running the virtualbox machine from the administrator account. Same issue.


  • no_root_squash is for NFS, not CIFS. Jan 6 '12 at 23:41
  • Do you have at least change permissions in the Windows share, and the NTFS acls on the files/directories you are accessing? Are you using the root account when you are trying to modify things under /mnt/company-build?
    – Zoredache
    Jan 6 '12 at 23:42
  • I have access to the windows box, I have set the folders share to be everyone can do everything, also the user I have mounted is an admin with full permissions (on the windows box). I am using root when trying to modify things in /mnt/company-build/. Thanks.
    – mtyson
    Jan 6 '12 at 23:52
  • When you connect to the share who does windows see you as (sessions will tell you)
    – Jim B
    Jan 7 '12 at 6:37
  • That's a good thought. When I am logged in as the user 'uname' (the one I use to mount from unix), if I try net session, I get access denied, however, if I run as administrator the commandline window, I can see the mount session: \\ UNAME Linux version .... Not sure what to make of that - uname is an administrator accont. Thanks for the idea.
    – mtyson
    Jan 7 '12 at 17:20

What appear to be the file (and parent directory) permissions when seen from Linux?

Try adding file_mode=777 and dir_mode=777 to your options: if the server does not support the CIFS Unix extensions this overrides the default file mode or the default mode for directories.

Also: have you tried bash <script>?

  • Here's the permissions: -rwxr-xr-x 1 root root 671 Jan 6 11:31 myScript.sh. bash blows up because I think I need to run dos2unix on it. I tried adding file_mode and dir_mode, but they didn't seem to help. I also tried umask=777. If I just re-run mount /mnt/company-build, it should pick up the new settings? Thanks.
    – mtyson
    Jan 7 '12 at 0:31
  • I'm not sure. However mount should tell you which options are active.
    – S19N
    Jan 7 '12 at 0:37
  • I see, it appears when I run mount with the file_mode and dir_mode set, it reduces the perms like so: -r----x--t. Here's the entry from mount: //<ip>/head_build on /mnt/company-build type cifs (rw,nodev,uid=0,gid=0,username=uname,password=pword,iocharset=utf8,file_mode=777,dir_mode=777)
    – mtyson
    Jan 7 '12 at 0:45
  • Ah, maybe file_mode and dir_mode requires a leading 0 as in file_mode=0777 and dir_mode=0777 ?
    – S19N
    Jan 7 '12 at 1:04
  • 1
    Simpler test, can you now write (touch test) in that folder? If yes, dos2unix -n infile outfile should do it. Possibly related: support.novell.com/techcenter/psdb/… and linuxquestions.org/questions/linux-networking-3/… .
    – S19N
    Jan 7 '12 at 1:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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