formating a filesystem with python

R

Ricardo Tiago

Hi all,

is there a package in python that allows to mount/umount and format
(to ext3) a filesystem? I know that this is possible by just calling
the os commands 'mount/umount and mkfs' but this would imply to have
to change sudoers to run the script as non-root.

Thanks
Ric
 
D

Diez B. Roggisch

Ricardo said:
Hi all,

is there a package in python that allows to mount/umount and format
(to ext3) a filesystem? I know that this is possible by just calling
the os commands 'mount/umount and mkfs' but this would imply to have
to change sudoers to run the script as non-root.

well, that's a very sensible unix-restriction. and you can't overcome that.

IOW: no, there is no such thing.

Diez
 
S

Sean DiZazzo

Hi all,

is there a package in python that allows to mount/umount and format
(to ext3) a filesystem? I know that this is possible by just calling
the os commands 'mount/umount and mkfs' but this would imply to have
to change sudoers to run the script as non-root.

Thanks
Ric

You can use pexpect to become root without changing sudoers. Assuming
you know the root password...

~Sean
 
R

Ricardo Tiago

I understand that this is a very sensible unix question but i think
fuse does this at least it mounts. I was wondering if there were other
packages with similar functionality.
 
D

Diez B. Roggisch

Ricardo said:
I understand that this is a very sensible unix question but i think
fuse does this at least it mounts. I was wondering if there were other
packages with similar functionality.

I don't know what fuse is.

And *mounting* can be allowed to be made by users. and possibly there is
a mount-daemon that can mount e.g. usb-devices. but that wouldn't be a
pure python-module-solution either.

Diez
 
F

Florian Diesch

Ricardo Tiago said:
is there a package in python that allows to mount/umount and format
(to ext3) a filesystem? I know that this is possible by just calling
the os commands 'mount/umount and mkfs' but this would imply to have
to change sudoers to run the script as non-root.

On Linux (I guess that"s the target OS as you mentioned ext3) mounting
could be done as non-root using FUSE or HAL (maybe using a frontend
like gio or kio) if the system supports that, or with an appropriate
fstab entry.

Maybe HAL can configured to do mkfs but that has to be done very
carefully to avoid security problems.

Maybe you could use something like AppArmor, too.

Most likely you get better answers by first asking in a Linux group
how to do this things without root privileges and then come back to
ask how to do it with Python.



Florian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top