Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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!

share|improve this question
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 1 '09 at 20:34
    
I think did a move, was the same volume and the FS is NTFS –  user19085 Sep 1 '09 at 20:42
    
A move preservers the permissions of the file (its the "same" file). –  Igal Serban Sep 1 '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? –  user19085 Sep 1 '09 at 20:49
1  
Can't tell you how many freaking times this has bitten me... –  squillman Sep 1 '09 at 21:10

2 Answers 2

up vote 3 down vote accepted

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)
share|improve this answer
    
This is exactly what I was looking for, thank you very much! +1 btw –  user19085 Sep 1 '09 at 21:00
1  

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.

share|improve this answer
    
Couldn't agree more Igal! We humans tend to do such things! I'll be working on that. Thanks! –  user19085 Sep 3 '09 at 14:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.