[Mono-list] Mono and file access

Peter Hagen peter at wingsofdeath.nu
Sun May 18 05:30:41 EDT 2008


Hi Andre

I use a process object to start a shell execute and execute the sudo.
You can describe you executable in the /etc/sudoers file. Check the link
for more information

<http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch09_:_Linux_Users_and_Sudo>

You should probably grant www-data (or some user like that) to have sudo
rights and without requesting a password (NOPASSWD). This is how I did
it. Something like:

%operator ALL= NOPASSWD: /usr/bin/...

Be sure to edit the /etc/sudoers with visudo,  cause that script checks
if your configuration is correct

Good luck

Peter


On Sun, 2008-05-18 at 10:25 +0200, Andre van Staden wrote:
> OK , one of those problems that shows that the Unix FS actually works.
> 
> I want to write a generic installation tool for 'publishing ' my 
> projects from my development system to my server.  This requires that I 
> alter the mono-server config files etc.
> 
> Easy to manually as I can sudo and do the work.  I am however a lazy 
> person that would rather have myself a program that can do this for me. 
> As I expected, changing the user under which a program runs is not as 
> simple as just calling Syscall.setuid.  I do not want to go and change 
> the access rights of the config files as I think is is good that only 
> root can write to them. 
> 
> How do I get my program to, when I supply my sudo password, obtain root 
> rights until it has done the changes to the program (that is short of 
> the famous Unix 'glue everything together with shell\ scripts' 
> solution.  I for once would like to program on Unix in a manner that my 
> entire project is C# based and not a mixture of C# and shell scripting.
> 
> Any help will be appreciated
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list



More information about the Mono-list mailing list