Initiating this ticket, I made a skrivener's error and put my Joomla version in the PHP version box. Sorry. They are Joomla 3.3.1 and PhP 5.3.28.
Also, when I wrote my first message, I did not consciously recall the prior occasion of my own in which a set of main-site directories had been restored, that time to a different off-site folder, with basically the same fact pattern as this time where my intention as user was to allow ANGIE to particularly copy the restored /external_files to where they belonged but somehow got teh full main site restore directed to that offsite directory.
Thirdly, I just said above that a "database" was copied to the off-site directory. I don't know why. I meant the files that were in the Akeebabackup of the main site were restored to the external folder. While it seemed to have that effect, from my user perspective it looked like I was just waiting for ANGIE.
Further to my previous mention of the permission states of files I found, I cannot add much of my own, but I am informed by some luck Googling that someone running PhP 5.2.5 said that he tried to upload something and by mistake got files with these weird 341 permissions. But the situation had really nothing else I could discern in common with this, except it contained a possible solution to a skrivener's error of another kind, one that to see it you gotta look hard.
The fellow who had the issue and created files with 341 permissions like mine wrote this code which contains Linux commands something like this
if(!mkdir($folder,"0777",true)){[/code]
There was a little explanation that shed another light on how the files really get their permissions.
It mentioned a Linux command "unmask" was mentioned as follows: "The real permissions depend on the parameter to mkdir and the umask. The umask is subtracted from the permissions given to mkdir. Try setting your umask to 0 before doing the mkdir." After thinking about that, I can say of my first-hand knowledge that the Linux file system assigns file permissions through a step-wise process in which the permissions are applied that equals the difference between two parameters. If either parameter is unreadable by Linux, the consequences can be weird.
But the reason I mentioned that guy's code is that there happened to be a very simple fix provided to him by another guy who also would not come close to being in a class to even mention in the same paragraph as you when it comes to knowledge. But it quickly solved his Linux problem, which I am sure you saw, which was that 0777 does not require quotes because it is an octal rather than a text string, he said in this article I saw in StackOverflow via Google.
subject- was-php-creates-folder-with-341-permissions
His user input was nothing much like mine. First my input, if you recall, was to terminate the program, go onto my admin side and my front end, find everything perfect as usual. But I must admit to you and everyone that at that point I did in fact hit every darn button I could think of to terminate dear ANGIE, and I say that with all due respect to your beautiful baby, who serves me so well time and again.
My conclusion is that when Linux fails to read the necessary input parameter's value, it might result in the weird 341 permissions depending on the two parameters that were in place and whether Linux could read only one of the two parameters needed for its rules to set the correct permissions. If the uploading routine has an unreadable mkdir parameter then I think an unmask octal still gets subtracted, but since it is subtracted from from zero rather than subtracting it from a 777 parameter value it came out weird, which might depend on whether or how Linux handles negative numbers.