473,799 Members | 2,779 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3484
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.c omwrote:
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.w eb.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.c omwrote:
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
1310
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 from modules sys, fileobject, but also import from file, path resolving etd.
9
5813
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 held in memory and therefore fast, without risk of damaging real files, and with none of the messiness of leftover files after testing. Googling the archives and the web suggests that only I and Remy Blank have done much along these lines. I...
2
2715
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 on which everyone's database resides. Anyway, it occured to me that I could create a special file for each database user of limited size, and make a filesystem on top of that file. The file could be owned by the user. Then, each user could have...
7
1756
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. The easy solution would be to use a zip file or a tar file. Python has good standard modules for accessing those types. However, I would tend to think that modifying or deleting files in the archive would require rewriting the entire archive. ...
5
3426
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 __FOO_ #include "boost/filesystem.hpp"
0
1753
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 just give them one-by-one. For little tables 100/20 formating cell by cell work ( i try with borders) fine. But when i get 5000/20 excel say: Too many different cell format! and excel remove some of the formats :( Pls help i need to format...
1
3032
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 SAMBA or windows filesharing or thru something else like WebDav. The idea is that I scan a local filesystem and then create relations between those files stored in a relational database, eg. a create a group called family, add a bunch of files...
2
1118
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 info. note that normal file open/write operations in python, i know it. i specificly need to know that "is a file already open by some other process other than python".
4
3735
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 and the allocation unit size even then it is not performing the formating work ihave done format using the "HP USB Disk Storage Format Tool" here it displays as "the volume is too big"
0
10482
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10251
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9072
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7564
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.