Results 1 to 10 of 10

Thread: win2003server: problem with user permission

  1. #1
    Join Date
    Oct 2007
    Location
    Italy
    Posts
    172
    Thanks
    39
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default win2003server: problem with user permission

    Hello, i compiled my app and i installed it under win2003server as admin.
    If i run my app as admin i've not problem, but if i run it as simple user i can't create directories and files, i have no this permission.

    The directory path, where to save data, are saved with QSetting in some keys, for example, they are in:

    HKEY_CURRENT_USER->Software->myapp
    keyname: path
    keyvalue: C:\Documents and settings\admin\myapp

    this for admin user.
    Now, i switch user and i try with a simple user, the key "path" is always in the same place with the same value..., so when i lunch my app and i try to write a directory on filesystem i get an error, but a normal user can't write in "C:\Documents and settings\admin\myapp" 'cause , he/she has not the permission.

    I hope i've been clear
    What should i do to fix it?
    thx

    edit
    -------------------------------
    to retrieve the path where to save data i use:
    QDir::home ().absolutePath()
    Last edited by mattia; 12th February 2008 at 10:44.

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: win2003server: problem with user permission

    Now, i switch user and i try with a simple user, the key "path" is always in the same place with the same value..., so when i lunch my app and i try to write a directory on filesystem i get an error, but a normal user can't write in "C:\Documents and settings\admin\myapp" 'cause , he/she has not the permission.
    When running as a regular user you must write to "C:\Documents and settings\username\myapp". Of course you can't access the admin home folder as a regular user. Can you access the root directory on linux as a regular user?

  3. The following user says thank you to marcel for this useful post:

    mattia (12th February 2008)

  4. #3
    Join Date
    Oct 2007
    Location
    Italy
    Posts
    172
    Thanks
    39
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: win2003server: problem with user permission

    i know that...i was asking about a solution for that problem, my question is:
    how to read the correct path (C:\Documents and settings\currentUser\myapp) if i installed the app like admin but i run it as normal user?
    Is there a way to write in C:\Documents and settings\currentUser\myapp ?

  5. #4
    Join Date
    Nov 2007
    Posts
    89
    Thanked 21 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: win2003server: problem with user permission

    You can use QDir::home() or QDir::homePath().

  6. #5
    Join Date
    Oct 2007
    Location
    Italy
    Posts
    172
    Thanks
    39
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: win2003server: problem with user permission

    I've already tried with homePath() but it's the same...

  7. #6
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: win2003server: problem with user permission

    What does homePath returns then?

  8. #7
    Join Date
    Jan 2008
    Location
    Warsaw, Poland
    Posts
    26
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    2

    Default Re: win2003server: problem with user permission

    Quote Originally Posted by mattia View Post
    my question is:
    how to read the correct path (C:\Documents and settings\currentUser\myapp) if i installed the app like admin but i run it as normal user?
    Is there a way to write in C:\Documents and settings\currentUser\myapp ?
    I'm not sure if any program can write in user's "home" directory in W2K3. Applications shoud use rather %APPDATA% directory. Look at my post:
    Re: How to find Application Data directory?
    Also check whether your non-admin user has rights to write in his directory.

  9. #8
    Join Date
    Nov 2007
    Posts
    89
    Thanked 21 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: win2003server: problem with user permission

    Quote Originally Posted by mattia View Post
    I've already tried with homePath() but it's the same...
    Do you mean that if you call homePath() as user someuser it returns C:\Documents and settings\Administrator? From its documentation this is not possibile. Check if %USERPROFILE% env variable points to right directory.

    @przemoc
    Many applications (including designer and assistant) use %USERPROFILE%\.appname directory to store data, so I believe it is writable.

  10. The following user says thank you to bender86 for this useful post:

    mattia (13th February 2008)

  11. #9
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: win2003server: problem with user permission

    On Vista everything is OK. The correct user directory is returned.
    Make sure you don't have any mistakes in your code.

  12. The following user says thank you to marcel for this useful post:

    mattia (13th February 2008)

  13. #10
    Join Date
    Oct 2007
    Location
    Italy
    Posts
    172
    Thanks
    39
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: win2003server: problem with user permission

    I double-checked my code and it was a my mystake, if i use homePath() i can retreive the right path.
    thx

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.