digitalmars.D.learn - How to make a directory?
- "Minas" <minas_mina1990 hotmail.co.uk> May 01 2012
- =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= <xtzgzorex gmail.com> May 01 2012
- Kevin Cox <kevincox.ca gmail.com> May 01 2012
- Jordi Sayol <g.sayol yahoo.es> May 01 2012
What is the D way to create a directory?
I can use the C function system("mkdir ...") but it doesn't seem
very good to me.
Also, is there a way to require the root password of the user
when going create the directory in a restricted folder (like
/usr) AFTER the application has started?
Thank you.
May 01 2012
On 02-05-2012 01:45, Minas wrote:What is the D way to create a directory? I can use the C function system("mkdir ...") but it doesn't seem very good to me.
It's not in the most obvious of places: http://dlang.org/phobos/std_file.html#mkdir (But then again, an std.directory module would probably be a bit overkill...)Also, is there a way to require the root password of the user when going create the directory in a restricted folder (like /usr) AFTER the application has started?
No idea, sorry.Thank you.
-- - Alex
May 01 2012
--0015175cf89e5eaf5f04bf0273dc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On May 1, 2012 7:49 PM, "Alex R=C3=B8nne Petersen" <xtzgzorex gmail.com> wr= ote:Also, is there a way to require the root password of the user when going create the directory in a restricted folder (like /usr) AFTER the application has started?
No idea, sorry.Thank you.
-- - Alex
You could execute a system command and change your apps privileges but this is a bad/risky way to do it. I would use sudo or gksudo and launch the command externally so that you don't grant your app root permissions and then do something stupid. If those actions are common I would only allow root to use your app. --0015175cf89e5eaf5f04bf0273dc Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <p><br> On May 1, 2012 7:49 PM, "Alex R=C3=B8nne Petersen" <<a href=3D= "mailto:xtzgzorex gmail.com">xtzgzorex gmail.com</a>> wrote:<br> >><br> >> Also, is there a way to require the root password of the user when= going<br> >> create the directory in a restricted folder (like /usr) AFTER the<= br> >> application has started?<br> ><br> ><br> > No idea, sorry.<br> ><br> >><br> >> Thank you.<br> ><br> ><br> > -- <br> > - Alex</p> <p>You could execute a system command and change your apps privileges but t= his is a bad/risky way to do it.=C2=A0 I would use sudo or gksudo and launc= h the command externally so that you don't grant your app root permissi= ons and then do something stupid.=C2=A0 If those actions are common I would= only allow root to use your app.<br> </p> --0015175cf89e5eaf5f04bf0273dc--
May 01 2012
Al 02/05/12 01:45, En/na Minas ha escrit: [...]Also, is there a way to require the root password of the user when going create the directory in a restricted folder (like /usr) AFTER the application has started?
In Linux, files and directories have the "setuid" and "setgid" special flags that allow ordinary users to execute binaries with temporary privileges of binary file owner or group. i.e., /usr/bin/passwd (owns root, with setuid) modifies /etc/passwd by any user without write permission. /bin/ping (owns root, with setuid) allows any user to send and listen control packages throw net interfaces. -- Jordi Sayol
May 01 2012









=?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= <xtzgzorex gmail.com> 