why i can't read sda1 with python?
Xia
zhxia at njnet.edu.cn
Mon Jun 4 04:14:53 EDT 2012
#ls -l /dev/sda1
will print
brw-r----- 1 root disk ...
so only root or accounts in group disk can access /dev/sda1,
you could add the account into group disk with usermod, then re-login.
On Sat, 2 Jun 2012 10:14:36 +0800
"水静流深" <1248283536 at qq.com> wrote:
> tiger at debian:~$ sudo fdisk -l
>
> Disk /dev/sda: 120.0 GB, 120034123776 bytes
> 255 heads, 63 sectors/track, 14593 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
> Sector size (logical/physical): 512 bytes / 512 bytes
> I/O size (minimum/optimal): 512 bytes / 512 bytes
> Disk identifier: 0x073a3c87
>
> Device Boot Start End Blocks Id System
> /dev/sda1 * 1 1912 15358108+ c W95 FAT32 (LBA)
> /dev/sda2 1913 3736 14647296 b W95 FAT32
> /dev/sda3 3736 3979 1952768 83 Linux
> /dev/sda4 3979 14594 85260289 5 Extended
> /dev/sda5 3979 4040 487424 83 Linux
> /dev/sda6 4040 4769 5858304 83 Linux
> /dev/sda7 4770 4891 975872 83 Linux
> /dev/sda8 4891 5134 1951744 83 Linux
> /dev/sda9 5134 14374 74217472 83 Linux
> /dev/sda10 14374 14594 1764352 82 Linux swap / Solaris
>
> i want to read sda1 with python:
> >>> file=open('/dev/sda1','rb')
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> IOError: [Errno 13] Permission denied: '/dev/sda1'
>
> how can i own the access to read sda1?
More information about the Python-list
mailing list