0

Today I did a web site update and got this strange behavior I never experienced before. I always copy files from a build folder to the prod folder. After I copied the file, I started getting a permission denied error in the web site, so I went to the file's property and noticed that it didn't has any of the corresponding permissions. My thought is that when copied the file, it didn't get the permissions inherited. Do you think this is something possible, and if so, what did I do wrong that caused that behavior?

Thanks!

  • 1
    Did you do a copy or move? Was it from a folder on the same volume or a different volume? What FS is used on the source volume? – Daniel Lucas Sep 01 '09 at 20:34
  • I think did a move, was the same volume and the FS is NTFS –  Sep 01 '09 at 20:42
  • A move preservers the permissions of the file (its the "same" file). – Igal Serban Sep 01 '09 at 20:46
  • @Igal: so you say a move could cause this behavior because if the file had different permissions on the source machine and then copied to the prod server, and then moved to the prod folder, could never get its permissions inherited, but if I did a copy it should have those assigned? –  Sep 01 '09 at 20:49
  • Basically yes. I didn't put it as the answer because it is based on flashkube question. When it was *copied* to the prod server it inherited the permissions of the folder it was copied to. And then it move to the iis folder with those permissions. – Igal Serban Sep 01 '09 at 20:59
  • 1
    Can't tell you how many freaking times this has bitten me... – squillman Sep 01 '09 at 21:10

2 Answers2

3

Moving files or folders within an NTFS volume will not cause the moved files/folders to inherit permissions from the destination folder.

If you copy files/folders within a volume OR if you move files/folders to a different volume, the copied items inherit the permissions of the destination folder.

Examples:

  • Move C:\MyFolder to C:\SubFolder: MyFolder retains its own permissions (moving within the same volume)
  • Copy C:\MyFolder to C:\SubFolder: MyFolder inherits the permissions defined on SubFolder (copying within the same volume)
  • Move C:\MyFolder to D:\DubFolder: MyFolder inherits the permissions defined on SubFolder (moving between different volumes)
ThatGraemeGuy
  • 15,314
  • 12
  • 51
  • 78
0

The lesson to learn from that is that deployment should be done with scripts. And never by hand. This way errors are reproducible and can be investigated. And this is the way to improve.

Igal Serban
  • 1,575
  • 10
  • 6
  • Couldn't agree more Igal! We humans tend to do such things! I'll be working on that. Thanks! –  Sep 03 '09 at 14:46