Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 138239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:13:58+00:00 2026-05-11T07:13:58+00:00

I have a code that creates file(s) in user-specified directory. User can point to

  • 0

I have a code that creates file(s) in user-specified directory. User can point to a directory in which he can’t create files, but he can rename it.

I have created directory for test purposes, let’s call it C:\foo.

I have following permissions to C:\foo:

  • Traversing directory/Execute file
  • Removing subfolders and files
  • Removing
  • Read permissions
  • Change permissions
  • Take ownership

I don’t have any of the following permissions to C:\foo:

  • Full Control
  • File creation
  • Folder creation

I have tried following approaches, so far:


os.access('C:\foo', os.W_OK) == True

st = os.stat('C:\foo')
mode = st[stat.ST_MODE]
mode & stat.S_IWRITE == True

I believe that this is caused by the fact that I can rename folder, so it is changeable for me. But it’s content – not.

Does anyone know how can I write code that will check for a given directory if current user has permissions to create file in that directory?

In brief – I want to check if current user has File creation and Folder creation permissions for given folder name.

EDIT: The need for such code arisen from the Test case no 3 from ‘Certified for Windows Vista’ program, which states:

  1. The application must not allow the Least-Privileged user to save any files to Windows System directory in order to pass this test case.

Should this be understood as ‘Application may try to save file in Windows System directory, but shouldn’t crash on failure?’ or rather ‘Application has to perform security checks before trying to save file?’

Should I stop bothering just because Windows Vista itself won’t allow the Least-Privileged user to save any files in %WINDIR%?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T07:13:58+00:00Added an answer on May 11, 2026 at 7:13 am

    I recently wrote a App to pass a set of test to obtain the ISV status from Microsoft and I also add that condition. The way I understood it was that if the user is Least Priveledge then he won’t have permission to write in the system folders. So I approached the problem the the way Ishmaeel described. I try to create the file and catch the exception then inform the user that he doesn’t have permission to write files to that directory.

    In my understanding an Least-Priviledged user will not have the necessary permissions to write to those folders, if he has then he is not a Least-Priveledge user.

    Should I stop bothering just because Windows Vista itself won’t allow the Least-Privileged user to save any files in %WINDIR%?

    In my opinion? Yes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 116k
  • Answers 116k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Set layout="absolute" for your Application Add an Image component as… May 11, 2026 at 10:38 pm
  • Editorial Team
    Editorial Team added an answer The issue was not having the actual root certificate in… May 11, 2026 at 10:38 pm
  • Editorial Team
    Editorial Team added an answer Vim is an amazing piece of software, but pretty messy… May 11, 2026 at 10:38 pm

Related Questions

Background Lately I've become a fanatic that everything I type while working on a
EDIT: See my working code in the answers below. In brief: I have a
Quick summary: I have a Rails app that is a personal checklist / to-do
I'm working on a project which I'm really not sure how to unit test.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.