473,395 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

formating a filesystem with python

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
Sep 10 '08 #1
5 3455
Ricardo Tiago schrieb:
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
Sep 10 '08 #2
On Sep 10, 1:57*pm, "Ricardo Tiago" <rti...@gmail.comwrote:
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
Sep 10 '08 #3
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.

On Wed, Sep 10, 2008 at 11:14 PM, Diez B. Roggisch <de***@nospam.web.dewrote:
Ricardo Tiago schrieb:
>>
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
--
http://mail.python.org/mailman/listinfo/python-list
Sep 10 '08 #4
Ricardo Tiago schrieb:
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
Sep 10 '08 #5
"Ricardo Tiago" <rt****@gmail.comwrote:
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
--
<http://www.florian-diesch.de/>
-----------------------------------------------------------------------
** Hi! I'm a signature virus! Copy me into your signature, please! **
-----------------------------------------------------------------------
Sep 11 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jacek Cz | last post by:
Do you have some tips about making Python small (minimal list of modules) and isolated from filesystem. I have an idea #define Py_WITHOUT_FILES This switch should disable some function/modules...
9
by: Peter Hansen | last post by:
The term "mock filesystem" refers to code allowing unit or acceptance tests to create, read and write, and manipulate in other ways "virtual" files, without any actual disk access. Everything is...
2
by: Jeff Davis | last post by:
I have virtual hosted users on a server and some of them have a postgresql database. I'm concerned about the outside possibility that a user could create an infinite loop and fill up the partition...
7
by: Enigma Curry | last post by:
I need to store a large number of files in an archive. From Python, I need to be able to create an archive, put files into it, modify files that are already in it, and delete files already in it. ...
5
by: GaryE | last post by:
Hello: I am having trouble linking a couple of files using the boost::filesystem. I am using MSVC 6.0. Here is an abbreviated version of my problem: foo.h: #ifndef __FOO_ #define...
0
by: Fonix | last post by:
I'm trying to make table border with pyExcelerator. As i can see there is only cell formating!? If i'm wrong pls tell me what is method to make more then one cell to have same format, other then...
1
by: Thomas W | last post by:
I want to create a virtual filesystem based on a relational database. It might run as a server on a different machine, but it has to be available like a normal filesystem, either shared using...
2
by: bvidinli | last post by:
i started python programming a few months ago. now i need the code to understand if a file already opened in filesystem by another process ? i looked at docs, howtos, but did not find related...
4
by: srikanthmuvva | last post by:
usb: 32 gb problem: if i try to open the usb system displays a dialog box as format the drive then if i start to do formst the pen drive it is not displaying the filesystem...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.