Hi all,
How do I convince BASH that I'm root and that my UID is 0 and not 42?
I've tried editing the "djgpp.env" file.
I also tried installing an "etc/passwd" file under the djgpp
directory, with "dosuser" listed as having uid 0.
Regards,
Albert.
Am 21.07.2020 21:25, schrieb A. Wik (awik32@gmail.com) [via djgpp@delorie.com]:
Hi all,
How do I convince BASH that I'm root and that my UID is 0 and not 42?
I've tried editing the "djgpp.env" file.
I also tried installing an "etc/passwd" file under the djgpp
directory, with "dosuser" listed as having uid 0.
Regards,
Albert.
There is no way to do what you want to do.
MSDOS does not know anything about uid and similars
thus neither the port nor
the c library supports them in the way it is known from unix. All versions of this port have relayed on the getuid and setuid functions provided by the library. Because there is nothing like uid and alike on MSDOS these functions
emulate them for porting purposes with hard coded values. In the case of uid/gid
the value is 42 when read by getuid and expects an uid of 42 when set by setuid;
any different value will make setuid fail with EPERM.
Currently I have no intentions to update the bash port providing such an uid/gid
emulation. I even would not really know how to implement it in a way that it becomes a serious emulation of the unix functionality completely missed on MSDOS.
If you are completely despaired to have a root uid behaviour, you will have to modify the code of the [g|s]etui() functions of the library in such a way that they read a defined environment variable that defines the current uid/gid
to be used.
With this modified libc.a you can then recompile the bash port and
see what happens. But it is clear that no other program than the recompiled bash port will know about this modified g|s]etui(). In the worst case you would have to recompile also the shell utilities and file utilities and some other ports more. And if they really behave as root user mode on plain DOS needs to be investigated.
If all this is worth to be done must be decided by you. I am also not really convinced that this will work at all.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 251 |
Nodes: | 16 (2 / 14) |
Uptime: | 65:13:31 |
Calls: | 5,560 |
Calls today: | 3 |
Files: | 11,680 |
Messages: | 5,121,621 |