• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 228
  • Last Modified:

Drive access rigths

Hello windows security experts!

I'm working in a application that must access to a drive, but:

- only administration has permission to access the drive
- most of the users of the application don't have administration profile
- so, it's necessary to unblock the drive, copy the files again and block again it

I wonder if is possible to write a C or C++ program to unblock the drive, even if the program is executed by the normal user that doesn't has persmision to read the drive.

I supose that there is a command like UNIX 'sudo' or something like that, to perform this action. I have been looking a solution using  the 'DeviceIoControl' command, but I think I'm missing somethig because the application can't control a device if it has no rigths to do it (becouse of the profile).

The process could be like that:

1) get rigths to control a device
2) unblock
3) copy files
4) block
5) cancel rights

Any suggestion or code piece?

Thanks!!
0
elrichal
Asked:
elrichal
  • 3
  • 2
  • 2
1 Solution
 
msiceCommented:
I think the only way you could do this is if you coded the admin username and password to perform the unblock and relock of the drive. You could use Net command for this sounds sketchy to me.
0
 
mahmudaqCommented:
An ordinary user ( not an administrator) cannot change drive permissions/rights. However, a user with administrator privileges can change permissions by first taking ownership of the drive.

Its important to understand the difference here - you can have a user who is NOT the Administrator but is included in the Admninistrators Group - so has admin rights to take ownership.

On the other hand, a user who is not in the Administrators group cannot do this on standard NTFS security.
0
 
elrichalAuthor Commented:
Thanks mahmudaq, that's what I have try to write down in my question but my english is too bad I guess.

As far as I know in UNIX systems any user can execute 'Administration' comands using a special command named 'sudo'. You have to identify your self as the user with permissions and type the command you have to run.

I wonder if there is any way to do that in Windows to avoid the problem that the current user don't have as much permissions as a Administrator user.

Thanks.

Ricardo
0
2017 Webroot Threat Report

MSPs: Get the facts you need to protect your clients.
The 2017 Webroot Threat Report provides a uniquely insightful global view into the analysis and discoveries made by the Webroot® Threat Intelligence Platform to provide insights on key trends and risks as seen by our users.

 
mahmudaqCommented:
such a command does exist on Windows 2000 and XP: RUNAS

type runas on the console prompt and you'll get a message displayed regarding its usage.

you can also look up its documentation in Windows Help.
0
 
msiceCommented:
You can use the Net command for this and pass the Admins username and password.
0
 
elrichalAuthor Commented:
RUNAS ... that's what I was looking for ... thanks mahmudaq!

I will accept your answer but If you can provide any example, hint or advice of how and how not to use the command I can give you a higher grade. :) (125 points deserve this, don't you think?)

Thanks.
0
 
mahmudaqCommented:
heres a hint - the rest is up to you - i cant give you the entire solution ...

u can use the WinExec("DOS COMMAND",0) function in a Win32 Console App using Visual C++ to execute DOS commands from a C++ app.

as far as points and grade are concerned - just keep the grading fair coz id rather not get a grade at all than get a bad grade ...
0

Featured Post

What Security Threats Are We Predicting for 2018?

Cryptocurrency, IoT botnets, MFA, and more! Hackers are already planning their next big attacks for 2018. Learn what you might face, and how to defend against it with our 2018 security predictions.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now