Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #46595

Re: Create a file in /etc/ as a non-root user

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <davea@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.041
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'configure': 0.05; 'subject:file': 0.07; 'permissions': 0.09; 'python': 0.11; 'suggest': 0.14; 'folder.': 0.16; 'reason.': 0.16; 'received:74.208.4.195': 0.16; 'subject:non': 0.16; 'subject:user': 0.16; 'sudo': 0.16; 'wrote:': 0.18; 'header:User- Agent:1': 0.23; 'script': 0.25; 'permission': 0.26; 'least': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'unix': 0.29; 'file': 0.32; 'run': 0.32; 'guess': 0.33; 'mac': 0.33; "i'd": 0.34; 'but': 0.35; 'doing': 0.36; 'should': 0.36; 'skip:o 20': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'system.': 0.39; 'users': 0.40; 'commands': 0.60; 'simply': 0.61; 'save': 0.62; 'telling': 0.64; '(that': 0.65; 'received:74.208': 0.68; 'risk': 0.72; 'is)': 0.84; 'defeat': 0.91; 'same,': 0.91
Date Fri, 31 May 2013 07:11:58 -0400
From Dave Angel <davea@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6
MIME-Version 1.0
To python-list@python.org
Subject Re: Create a file in /etc/ as a non-root user
References <0e688580-c0fb-4caf-8fb1-f622b2c7bcb5@googlegroups.com> <4fc3af47-2dc4-4de1-9479-53741215c3a2@googlegroups.com>
In-Reply-To <4fc3af47-2dc4-4de1-9479-53741215c3a2@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:IMhx/AR2aB+l6an68rbx7iSJBOGXt0m6kRdtaiRedSh D+Pn/F/AX14KCo6pQtuqPSA6MWl3U8NrTDoVjoy+6kP/0Q+SRq sxk05EBIetNJg/My08ieh6WCBjeA1Iv7rrs3Z6aFc/LJiU7lk+ BXJQliLtcLEqzCH4EQGP0YkwOE4723Q+QsTpyJoxECf+Y8Ez5h Kdn/MhNMaYjWmxoc7+tPTC5PAoZWMWLm3g2zMP7x7+kSdQxhme wlFlcpb/+rjpAIkbJnXTX33hMyso0sUIHqYi4F0a2MwDq0r5/r IEjYPrisoPMGepXVQ/WrBu0IxaQCunYaATfQnrLg+OT4cHi/A= =
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2487.1369998737.3114.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369998737 news.xs4all.nl 15955 [2001:888:2000:d::a6]:54724
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:46595

Show key headers only | View raw


On 05/31/2013 05:27 AM, Luca Cerone wrote:
>> fd = open('/etc/file','w')
>>
>> fd.write('jpdas')
>>
>> fd.close()
>>
>>
> Hi Bibhu, that is not a Python problem, but a permission one.
> You should configure the permissions so that you have write access to the folder.
> However unless you know what you are doing it is discouraged to save your
> file in the /etc/ folder.
>
> I don't know if on Mac the commands are the same, but in Unix systems (that I guess Mac is) you can manage permissions with chmod.
>

That directory is protected from users for a reason.  You defeat that 
and risk the system.

Bibhu:  for that reason I'd suggest simply telling your users to run 
your script as root.  If they trust you, and it breaks something, at 
least they know why they were doing it.

    sudo  python  riskyscript.py




-- 
DaveA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Create a file in /etc/ as a non-root user BIBHU DAS <b13das91@gmail.com> - 2013-05-31 02:12 -0700
  Re: Create a file in /etc/ as a non-root user Luca Cerone <luca.cerone@gmail.com> - 2013-05-31 02:27 -0700
    Re: Create a file in /etc/ as a non-root user Dave Angel <davea@davea.name> - 2013-05-31 07:11 -0400
      Re: Create a file in /etc/ as a non-root user Alister <alister.ware@ntlworld.com> - 2013-05-31 14:02 +0000
        Re: Create a file in /etc/ as a non-root user Chris Angelico <rosuav@gmail.com> - 2013-06-01 00:42 +1000
          Re: Create a file in /etc/ as a non-root user rusi <rustompmody@gmail.com> - 2013-05-31 21:39 -0700
  Re: Create a file in /etc/ as a non-root user Nobody <nobody@nowhere.com> - 2013-06-01 01:20 +0100
    Re: Create a file in /etc/ as a non-root user Tim Chase <python.list@tim.thechases.com> - 2013-05-31 19:49 -0500
  Re: Create a file in /etc/ as a non-root user Denis McMahon <denismfmcmahon@gmail.com> - 2013-06-01 21:19 +0000
    Re: Create a file in /etc/ as a non-root user rusi <rustompmody@gmail.com> - 2013-06-01 19:51 -0700

csiph-web