digitalmars.D.learn - How to make a directory?
- Minas (7/7) May 01 2012 What is the D way to create a directory?
- =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= (8/15) May 01 2012 It's not in the most obvious of places:
- Kevin Cox (7/16) May 01 2012 You could execute a system command and change your apps privileges but t...
- Jordi Sayol (6/7) May 01 2012 In Linux, files and directories have the "setuid" and "setgid" special f...
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
On May 1, 2012 7:49 PM, "Alex R=C3=B8nne Petersen" <xtzgzorex gmail.com> wr= ote: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.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
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