This may be a simple question, but how can I "request" the / root priviliges system from a user in a c console application. I need to write / Private / etc, but I can not. This is for mac / unix.
I saw that it is used in other console commands, for example. when you run the following command: "sudo / System / Library / CoreServices / Finder.app / Contents / MacOS / Finder", Terminal asks for your password. How to do it?
thanks, jnk
, root. , seteuid , ( euid uid).
seteuid
sudo , setuid. , sudo , (root), , . sudo , , . , fork execve .
sudo
fork
execve
root , . fork/execve sudo . . , , . .
, Mac, - " ", , , . launchd , .
launchd
, , . "", . , , .
, ( ) sudo, . UNIX.
For UNIX systems, you need to have the setuid flag in your program, and it should check / etc / passwd and / etc / shadow for valid credentials. I believe the crypt (3) function is used to hash passwords. Not sure about the Mac.
Source: https://habr.com/ru/post/1782628/More articles:Unexpected ClassCastException with findViewById - androidCreate a dynamic CRUD user interface in WPF - designSAX XML Java Entities Problem - javaWhat is the best way to iterate through Hashtable entries WITHOUT java.lang.Map APIs? - javaProblem writing files with special characters in PHP + Apache - encoding problem - fileИнтеграция Pentaho с GWT - chartsUIDesign Tips - user-interfaceДобавление фонового изображения в UILabel - iosHornetQ embedding in Spring - javadwscript - can anyone help with examples of a debug editor, please? - debuggingAll Articles