Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Write to file as Different User

I am trying to write to a file that my local user account does not have access to, how can I open and write to the file as an administrator?

like image 985
user2570202 Avatar asked May 27 '14 13:05

user2570202


People also ask

How do I chmod to another user?

To change file and directory permissions, use the command chmod (change mode). The owner of a file can change the permissions for user ( u ), group ( g ), or others ( o ) by adding ( + ) or subtracting ( - ) the read, write, and execute permissions.

What does chmod 644 mean?

Permissions of 644 mean that the owner of the file has read and write access, while the group members and other users on the system only have read access.


1 Answers

You need to launch another process that has admin rights. To do that call ShellExecute with 'runas' as the second parameter (this will open a User Account Control dialog). That executable may be separate or may be the same one that is calling ShellExecute.

like image 77
Isso Avatar answered Oct 07 '22 00:10

Isso