PDA

View Full Version : Folder in admin account



mugi
12th September 2012, 22:45
Hi,

I'am developing a qt program that should be used by all users of a computer, but I want all the files generated by it stored in the administrator account, so that all users have access to the same files.
The problem is that accessing a folder in the administrator account from another users account requires a password !

My question is if its possible to give qt the password for the admin account ? Or maybe is there another way for saving files in one common location ?

thanks.

ChrisW67
12th September 2012, 23:05
Have your install procedure create a common directory with appropriate UNIX permissions (you might use the setgid or sticky bits). Somewhere under /var may be appropriate, or you could allow the system admin to determine a location that suits them and specify that to the program.

mugi
12th September 2012, 23:19
thanks,

sorry, I forgot to mention the program is intended for Windows users.
I want the files to be accessible for the application but not for the user.

ChrisW67
13th September 2012, 01:47
I selected UNIX because your profile lists only UNIX/X11.

The answer is the same though: create folder with appropriate permission in your installer. Windows has designated locations for global shared data (e.g. FOLDERID_ProgramData or FOLDERID_PublicDocuments in SHGetKnownFolderPath function (http://msdn.microsoft.com/en-us/library/bb762188%28v=vs.85%29.aspx)). These are not available through Qt4's QDesktopServices but may be available through Qt5 QStandardPaths

If the application can read or write the file then so can the user... the application runs with their privileges after all. You can slow down the user by maintaining obscurity about the location, prohibiting directory listing on the folder, encryption using an obscured embedded key etc.

Ginsengelf
13th September 2012, 07:07
Hi, there is also a Windows Environment Variable "ALLUSERSPROFILE", which points to a common directory for all users.

Ginsengelf

mugi
13th September 2012, 10:52
thank you very much for the replies,
Question answred

mugi