Hi,
The following is the problem and comments that I received.
Please let me know if they are correct.
Q: I’m trying to write
software that should access raw disk and analyze
file system structures.
For that I need to read
/dev/rdisk0 … rdisk1 etc files.
While I can open secondary
hard disk (/dev/rdisk1) using POSIX function open() and also fopen(), it fails
in case of system disk /dev/rdisk0 (permission denied).
ANS: You
must execute the open() of the root disk volume in an authenticated root user
process. Much the same way that you would use dd from the command line.
Q: Does
that mean I'll have to enter the admin user passwd thru some GUI.
ANS: Yes,
you will need to authenticate.
Q: But there are software in
the market that access the system disk with out getting the admin user to enter
the passwd.
ANS: I
suspect that those tools are not accessing the physical disk, but rather just a
partition and even then, the cooked rather than raw device node. You were
asking about the entire raw disk (/dev/ rdisk0). To access just a slice
is different (/dev/disk0s3 for example). That may be possible, but there
are situations where you're going to run into auth requirements.
Q: If I try and
implement Authorization, will the admin username and passwd be enough and will
there be no need to enable root account and get the user to enter root passwd?
I gather that root passwd can be different from admin passwd. I also tried
implementing “AuthForAll” sample code just to test but it was tricky
as I’m a newbie. Can anyone provide me with simple steps to run a process
as authorized to have system disk access? Also even if I succeed in reading the
system disk (/dev/rdisk0), how do I get its size, and other info like model
number etc?
Any help would be greatly appreciated.
Thanks in advance.
Navneet