0

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
                            BUILTIN\Administrators:F
                            BUILTIN\Administrators:(OI)(CI)(IO)F
                            NT AUTHORITY\SYSTEM:F
                            NT AUTHORITY\SYSTEM:(OI)(CI)(IO)F
                            Everyone:(OI)(CI)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.

Thanks!

mtyson
  • 193
  • 1
  • 10
  • `no_root_squash` is for NFS, not CIFS. – Ignacio Vazquez-Abrams Jan 06 '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 06 '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 06 '12 at 23:52
  • When you connect to the share who does windows see you as (sessions will tell you) – Jim B Jan 07 '12 at 06: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: `\\192.168.1.142 UNAME Linux version ...`. Not sure what to make of that - uname is an administrator accont. Thanks for the idea. – mtyson Jan 07 '12 at 17:20

1 Answers1

0

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>?

S19N
  • 1,803
  • 1
  • 19
  • 28
  • 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 07 '12 at 00:31
  • I'm not sure. However `mount` should tell you which options are active. – S19N Jan 07 '12 at 00: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: `///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 07 '12 at 00:45
  • Ah, maybe file_mode and dir_mode requires a leading 0 as in `file_mode=0777` and `dir_mode=0777` ? – S19N Jan 07 '12 at 01:04
  • That (using 0777) definitely set all the flags on everything to `drwxrwxrwx`, but I still get the `Failed to open output temp file: Permission denied` error when attempting to run dos2unix. I wonder what output temp file its trying to use... – mtyson Jan 07 '12 at 01:17
  • 1
    Simpler test, can you now write (`touch test`) in that folder? If yes, `dos2unix -n infile outfile` should do it. Possibly related: http://support.novell.com/techcenter/psdb/e2fcba9b269b573931672ddee97957e7.html and http://www.linuxquestions.org/questions/linux-networking-3/programs-cannot-create-temp-files-on-nfs-mounted-ntfs-file-system-665857/ . – S19N Jan 07 '12 at 01:25
  • No, I can't touch anything in there. Permission Denied. – mtyson Jan 07 '12 at 01:29
  • let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/2163/discussion-between-s19n-and-mtyson) – S19N Jan 07 '12 at 01:31