partition info in perl without root access

Sergey Kuznetsov tlug-9a/WvBvX2Qpg9hUCZPvPmw at public.gmane.org
Tue Nov 30 19:35:48 UTC 2004


df -ha + /proc/partitions will give Madison much more info than all 
other approaches.


All the Best!
Sergey.

Lennart Sorensen wrote:

>On Tue, Nov 30, 2004 at 11:32:01AM -0500, Madison Kelly wrote:
>  
>
>>>cat /proc/partitions any use?
>>>      
>>>
>><head slap>
>>
>>Yes, quite actually! Thank you!
>>    
>>
>
>It doesn't give anymore than a list of partitions the kernel knows
>about.  Free space and such and actual size are probably a different
>problem.  Actually free space on partition would require mounting or
>filesystem specific tools to figure out.
>
>To figure out actual disk size, partition sizes and unused space, well
>that would need fdisk, and it probably requries at least read access to
>the raw disk device node.
>
>Now on my system (running debian), any user added to the 'disk' group
>has full raw access to the disk and can hence use /sbin/fdisk.  probably
>not a safe idea in general as it lets the user modify the disk at will.
>Having just an sudo entry for running fdisk -l (and no other fdisk
>options) should actually be safe.  Sudo can be quite restrictive in how
>you are allowed to run a command.  You should be able to say something
>like 'only allow user to run fdisk -l' and then not allow passing any
>arguments.  It should then just list every partition on every disk and
>how big they are and how much unpartitioned space is on the disk and
>such.
>
>Now if you add software raid or lvm to the mix, you need additional
>tools to determine volume sizes and such. :)
>
>Lennart Sorensen
>--
>The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
>TLUG requests: Linux topics, No HTML, wrap text below 80 columns
>How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
>  
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gtalug.org/pipermail/legacy/attachments/20041130/ed07a017/attachment.html>


More information about the Legacy mailing list