Berimor66 / duplicati

Automatically exported from code.google.com/p/duplicati
0 stars 0 forks source link

Error: Attempted to perform an unauthorized operation #638

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Getting the below error whil trying to backup locked Outlook PST files on 
windwows Pro 7. VSS services is running. Running Duplicati as Admin.
Have snapshot-policy=required in options. This worked under Windows XP.
("vssadmin list writers" lists 11 writers)

Error: Attempted to perform an unauthorized operation.

Error: System.UnauthorizedAccessException: Attempted to perform an unauthorized 
operation.
   at Alphaleonis.Win32.Vss.VssBackupComponents..ctor()
   at Alphaleonis.Win32.Vss.VssImplementation.CreateVssBackupComponents()
   at Duplicati.Library.Snapshots.WindowsSnapshot..ctor(String[] sourcepaths, Dictionary`2 options)
   at Duplicati.Library.Snapshots.SnapshotUtility.CreateSnapshot(String[] folders, Dictionary`2 options)
   at Duplicati.Library.Main.RSync.RSyncDir.InitiateMultiPassDiff(Boolean full, Options options)
   at Duplicati.Library.Main.Interface.Backup(String[] sources)
   at Duplicati.GUI.DuplicatiRunner.ExecuteTask(IDuplicityTask task)
Cleanup output:

Original issue reported on code.google.com by pcegghead on 3 Jun 2012 at 5:48

GoogleCodeExporter commented 9 years ago
Are you certain that you are running as Administrator, not just as a user that 
can elevate permissions (with UAC)?

UnauthorizedAccessException means that your user does not have the correct 
permissions.
Maybe the user is blocked from creating VSS snapshots?

Original comment by kenneth@hexad.dk on 4 Jun 2012 at 7:51

GoogleCodeExporter commented 9 years ago
I will need to revisit how my wife's account is setup. I know she is a member 
of the Administrator's group, though because i checked after I got the error. 
Maybe I should turn off UAC (if it isn't already). I also  don;t know about her 
being blocked from runnning VSS as I did not set anything special up and was 
able to use another application to do a VSS full image backup of her system 
disk. I will check and report back. 

I recently found Duplication because Steve Gibson mentioned it on Security Now 
and I do love what i see so far and am anxious to get it working. Can't wait 
for the version that allows it to run as a service. 

Original comment by rjther...@gmail.com on 5 Jun 2012 at 2:14

GoogleCodeExporter commented 9 years ago
I just checked and her account is definitely an administrator account. I've 
disabled UAC through group policy but am still getting the error. However, the 
error is appearing even though Outlook is NOT running and the files should not 
be locked.

Am I the only person having thi sissue?

BackupType      : Incremental
TypeReason      : A full backup is made because the source folders have changed
BeginTime       : 06/07/2012 19:08:10
EndTime         : 06/07/2012 19:20:03
Duration        : 00:11:52.7907693
DeletedFiles    : 0
DeletedFolders  : 0
ModifiedFiles   : 0
AddedFiles      : 4
AddedFolders    : 0
ExaminedFiles   : 4
OpenedFiles     : 4
SizeOfModified  : 0
SizeOfAdded     : 2350903296
SizeOfExamined  : 2350903296
Unprocessed     : 0
TooLargeFiles   : 0
FilesWithError  : 0
Executable      : Duplicati, Version=1.3.2.1304, Culture=neutral, 
PublicKeyToken=8bfe994a39631a7b
Library         : Duplicati.Library.Main, Version=1.3.2.1304, Culture=neutral, 
PublicKeyToken=8bfe994a39631a7b
OperationName   : Backup
BytesUploaded   : 1199788805
BytesDownloaded : 11808
RemoteCalls     : 345
NumberOfWarnings: 1
****************
Failed to create a snapshot: System.UnauthorizedAccessException: Attempted to 
perform an unauthorized operation.
   at Alphaleonis.Win32.Vss.VssBackupComponents..ctor()
   at Alphaleonis.Win32.Vss.VssImplementation.CreateVssBackupComponents()
   at Duplicati.Library.Snapshots.WindowsSnapshot..ctor(String[] sourcepaths, Dictionary`2 options)
   at Duplicati.Library.Snapshots.SnapshotUtility.CreateSnapshot(String[] folders, Dictionary`2 options)
   at Duplicati.Library.Main.RSync.RSyncDir.InitiateMultiPassDiff(Boolean full, Options options)
****************

Cleanup output:

Original comment by pcegghead on 7 Jun 2012 at 11:27

GoogleCodeExporter commented 9 years ago
Do I need to install Microsoft Visual C++ 2008 SP1 Redistributable Package (x64)
in order for Duplicati to use VSS on Windows 7 x64? 

Could there be a conflict between running 32-bit Duplicati on a 64-bit OS and 
using VSS which is causing VSS not to work?

Original comment by rjther...@gmail.com on 8 Jun 2012 at 8:03

GoogleCodeExporter commented 9 years ago
This just does not work with locked Outlook PST files on Windows 7 x64. I tried 
running Duplicati on another Win7 X64 system and have the same problem. I am 
definitely an administrator on both systems and have sanapshot-policy=auto 
enabled. Too bad. I know it works on Windows XP OK. If you look at my first 
note in this hread, i see a reference to 
Alphaleonis.Win32.Vss.VssImplementation.CreateVssBackupComponents()
I am running a x64 version of duplicati. Just wondering why it's calling a 
Win32 method. 

Failed to process file: X:\Outlook\James Mail.pst. Error message: The process 
cannot access the file because another process has locked a portion of the file.

Original comment by pcegghead on 10 Jun 2012 at 12:11

GoogleCodeExporter commented 9 years ago
Strange, I have developed the VSS support on a x64 Win7 machine, so I am quite 
sure it works.
The name "Win32" is a legacy term back from when Windows became 32bit (it was 
16bit before), and now they are stuck with that name, even though some stuff is 
now starting be called Win64.

To run Duplicati.exe as admin, you must first close all running instances 
(check with taskmgr.exe).
Then right click the Duplicati icon in the start menu, and choose "Run as 
Administrator". AFAIK, that is the way to do it. Even if your account is an 
Admin account, you will not get elevated privileges unless the process 
specifically asks for them, and Duplicati does not do that. I have heard people 
working around this by setting a schedule that starts Duplicati as admin. Then 
they set the schedule to run 5sec after login.

And yes, you probably need the C++ redist, but you will not get an 
"UnauthorizedAccessException" if the redist package is missing.

Original comment by kenneth@hexad.dk on 12 Jun 2012 at 8:52

GoogleCodeExporter commented 9 years ago
I set the exe to run as administrator but same error. I think this is broken 
for Outlook PST files. I will ty some other locked files to see if they gat 
backed up.

BackupType      : Incremental
TypeReason      : An incremental backup is made because the latest full backup 
is from 6/9/2012 6:16:15 PM and the full backup threshold is 1M
BeginTime       : 06/13/2012 18:46:22
EndTime         : 06/13/2012 18:46:23
Duration        : 00:00:00.9900566
DeletedFiles    : 0
DeletedFolders  : 0
ModifiedFiles   : 1
AddedFiles      : 0
AddedFolders    : 0
ExaminedFiles   : 6
OpenedFiles     : 2
SizeOfModified  : 65536
SizeOfAdded     : 0
SizeOfExamined  : 225084416
Unprocessed     : 0
TooLargeFiles   : 0
FilesWithError  : 0
Executable      : Duplicati, Version=1.3.2.1304, Culture=neutral, 
PublicKeyToken=8bfe994a39631a7b
Library         : Duplicati.Library.Main, Version=1.3.2.1304, Culture=neutral, 
PublicKeyToken=8bfe994a39631a7b
OperationName   : Backup
BytesUploaded   : 9106
BytesDownloaded : 20855
RemoteCalls     : 10
NumberOfErrors  : 1
****************
Failed to process file: X:\Outlook\James Mail.pst. Error message: The process 
cannot access the file because another process has locked a portion of the file.

System.IO.IOException: The process cannot access the file because another 
process has locked a portion of the file.

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.ReadCore(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.FileStream.Read(Byte[] array, Int32 offset, Int32 count)
   at Duplicati.Library.SharpRSync.ChecksumFileWriter.AddStream(Stream stream)
   at Duplicati.Library.Main.RSync.RSyncDir.ProccessDiff(Stream fs, String s, ICompression signaturefile)
   at Duplicati.Library.Main.RSync.RSyncDir.MakeMultiPassDiff(ICompression signaturefile, ICompression contentfile, Int64 volumesize)
****************

Cleanup output:

Original comment by pcegghead on 13 Jun 2012 at 10:57

Attachments:

GoogleCodeExporter commented 9 years ago
OK. I think the issue is only with Outlook PST files that are open. Duplicati 
will backup EXE files that are in use and that I cannot delete interactively 
because they are open.

Would you be able to test this on Outlook PST files to confirm that this is an 
issue?

BTW, it DOES WORK on Windows XP but not on Windows 7 x64.
Thanks.

Original comment by pcegghead on 13 Jun 2012 at 11:08

GoogleCodeExporter commented 9 years ago
There are different ways to lock a file in Windows and Outlook uses the hardest 
kind of lock. The .exe files are usually just locked with read access. Outlook 
prevents any read and write access to the pst files while running.

I seem to recall some weirdness with setting that "Run the program as 
administrator" flag, where it would not always kick in after a reboot, but I 
have not yet investigated it.

Have you tried exiting the Duplicati from the tray, and then right clicking 
"Run as Administrator" ?
In my experience that always worked.

Original comment by kenneth@hexad.dk on 20 Jun 2012 at 7:20

GoogleCodeExporter commented 9 years ago
>Have you tried exiting the Duplicati from the tray, and then right clicking 
"Run as >Administrator" ? In my experience that always worked.

Yes, I've tried everything but nothing will allow Duplicati to backup open PST 
files.

Original comment by pcegghead on 20 Jun 2012 at 8:25

GoogleCodeExporter commented 9 years ago
I just tried this again, Win7 x64, UAC on.

Exit all Duplicati processes.
Right click and say "Run as Administrator".
Click Yes to UAC prompt.
Run backup with snapshot-policy=required.
All good, no error messages.

Repeat without "Run as Administrator".
Fails with "Attempted to perform unauthorized operation."

If you are 100% sure you are running as administrator,
I am guessing that something else is blocking you.
You can try running the tool Duplicati.Library.Snapshots.exe from an 
Administrator command prompt and see if you can get a more exact error.

Original comment by kenneth@hexad.dk on 26 Jun 2012 at 1:46

GoogleCodeExporter commented 9 years ago
Do I need to start duplicati with a command line option to enable snaphots or 
just do it through the GUI?

C:\Program Files (x86)\Duplicati>Duplicati.Library.Snapshots.exe
Creating file C:\Program Files (x86)\Duplicati\testfile.bin
Attempting to read locked file C:\Program Files (x86)\Duplicati\testfile.bin
The file C:\Program Files (x86)\Duplicati\testfile.bin was correctly locked, 
message: The process cannot access the file 'C:\Program Files (x86)\D
plicati\testfile.bin' because it is being used by another process.
Creating snapshot for folder: C:\Program Files (x86)\Duplicati
If this fails, try to run as Administrator
Attempting to read locked file via snapshot
Could open locked file C:\Program Files (x86)\Duplicati\testfile.bin, through 
snapshot
* Test passed

C:\Program Files (x86)\Duplicati>

Original comment by rjther...@gmail.com on 26 Jun 2012 at 11:40

GoogleCodeExporter commented 9 years ago
This is weird. for some reason it appears to be working now. I have to confirm 
with more tests. I did uninstall ShadowProtect backup which also uses it's own 
snapshot manager but not sure if that was the reason...Stay tuned and thanks 
for your help.

Original comment by rjther...@gmail.com on 27 Jun 2012 at 2:03

GoogleCodeExporter commented 9 years ago
+rjther...@gmail.com Do you still have this working. I am have exactly the same 
problem.

Original comment by bill@weehooey.com on 3 Jan 2013 at 9:15

GoogleCodeExporter commented 9 years ago
Yes, it's been working ever since.

Original comment by JCMike...@gmail.com on 3 Jan 2013 at 9:43

GoogleCodeExporter commented 9 years ago
May I ask how you did it? I cannot get it to run with admin priv so it can use 
the volume shadow copy.

Original comment by bill@weehooey.com on 3 Jan 2013 at 9:54

GoogleCodeExporter commented 9 years ago
If i recall it just started working mysteriously. The only option i have 
selected is snapshot-policy=required 

Original comment by JCMike...@gmail.com on 4 Jan 2013 at 8:57

GoogleCodeExporter commented 9 years ago
It would be best if Duplicati had a user option in Windows to force it to run 
with administrator permissions at startup.  It is reasonable to expect a backup 
utility to demand administrator permissions while running.  However, a 
one-size-fits-all solution would be a checkbox that requires Duplicati to 
verify that it has been run with administrator permissions.  This might have 
saved a bit of debugging time for me.

Original comment by jbyrd@giganticsoftware.com on 20 Jun 2014 at 7:16