accessing fdisk -l as user

Leonard Chatagnier lenc5570 at sbcglobal.net
Thu Aug 14 02:11:37 UTC 2008


--- Patrick Drechsler <patrick at pdrechsler.de> wrote:

> Hi,
> 
> can I access the output of 
> 
> fdisk -l
> 
> as user on Ubuntu 8.04.1 LTS?
> 
> I would like to use this information for a script
> without root
> privileges. The user running this script is sudo
> user.
> 
> According to the man page of fdisk, the -l option
> is:
> 
> ,----
> | -l List the partition tables for the specified
> devices and then exit.
> | If no devices are given, those mentioned in
> /proc/partitions (if that
> | exists) are used.
> `----
> 
> The file /proc/partitions is empty:
> 
> ,----
> | # ls -al /proc/partitions
> | -r--r--r-- 1 root root 0 2008-08-14 03:23
> /proc/partitions
> `----
> 
> Should this file be created automatically during
> boot time?
> 
> Thankful for any pointers,
For me on a X86_64 ubuntu, fdisk -l /dev/sda without
sud gave no output, well it said "Cannot open
/dev/sda". ls -al /proc/partitions gave your same
results with $ prompt.  But cat /proc/partitions
listed all my partitions using a $ prompt.  HTH. Don't
have any idea on your last question.

Leonard Chatagnier
lenc5570 at sbcglobal.net




More information about the ubuntu-users mailing list