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


Groups > comp.lang.python > #46603

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!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'root': 0.05; 'linux,': 0.07; 'postgresql': 0.07; 'subject:file': 0.07; 'skip:/ 10': 0.09; 'used.': 0.09; 'runs': 0.10; 'random': 0.14; 'bash,': 0.16; 'corrupt': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'happily': 0.16; 'subject:non': 0.16; 'subject:user': 0.16; 'applies': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'have:': 0.19; 'user.': 0.19; 'config': 0.24; 'instance,': 0.24; 'login': 0.25; 'options': 0.25; 'this:': 0.26; 'primary': 0.26; 'somewhere': 0.26; 'gets': 0.27; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; 'expanding': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'that.': 0.31; 'too.': 0.31; 'url:wiki': 0.31; '(my': 0.31; 'url:wikipedia': 0.31; 'stuff': 0.32; 'running': 0.33; 'maybe': 0.34; 'could': 0.34; 'received:209.85': 0.35; 'common': 0.35; 'created': 0.35; 'received:209.85.220': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'url:org': 0.36; 'wrong': 0.37; 'application': 0.37; 'operating': 0.37; 'received:209': 0.37; 'represent': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'that,': 0.38; 'extremely': 0.39; 'itself': 0.39; 'skip:. 10': 0.39; 'to:addr:python.org': 0.39; 'system.': 0.39; 'users': 0.40; "you'll": 0.62; 'different': 0.65; 'close': 0.67; 'home': 0.69; 'user,': 0.69; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=rM60yo6YR11YIryf8lHQ7AsKlUQ4eJ2kDk0enl/1O74=; b=GrCZ4PWB/5Bwt4Lqd6wEDl1UbhiGWktYpLD0b09QM3D9IRP6UBZwxYVvqIvEYfKtO0 dtpnJ9XPilOjItsSSdjjLosc9IjQuXgCteEL5oMFVkQksyuC16ynw6KUywNdZxNMEQFv 8n2v9gr8/bVHIRU/6uHbiTsyrllMZOFCqSjDtvXwD4bT2jcbRK/peKVuCplVDgBMsZp5 caXmQ7y7zcyIlWJ8vmi0YLB+6TUOP5GapVJwATM43NY2WV+Zman/VZW8HiHc0LsXlUON h93XpQTiZdje4/yxBajrcrfJQdfpA6Uy/dFi4/J7G3+2Q43mGr+aCreifQMNYBjwMfvs 0Esg==
MIME-Version 1.0
X-Received by 10.52.65.238 with SMTP id a14mr8824475vdt.24.1370011333304; Fri, 31 May 2013 07:42:13 -0700 (PDT)
In-Reply-To <042qt.10122$tu1.2940@fx20.am4>
References <0e688580-c0fb-4caf-8fb1-f622b2c7bcb5@googlegroups.com> <4fc3af47-2dc4-4de1-9479-53741215c3a2@googlegroups.com> <mailman.2487.1369998737.3114.python-list@python.org> <042qt.10122$tu1.2940@fx20.am4>
Date Sat, 1 Jun 2013 00:42:13 +1000
Subject Re: Create a file in /etc/ as a non-root user
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
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.2491.1370011335.3114.python-list@python.org> (permalink)
Lines 37
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1370011335 news.xs4all.nl 15908 [2001:888:2000:d::a6]:35521
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:46603

Show key headers only | View raw


On Sat, Jun 1, 2013 at 12:02 AM, Alister <alister.ware@ntlworld.com> wrote:
> /etc is used to store configuration files for the operating system & if
> you inadvertently corrupt the wrong one then you could kill the system.

Expanding on this:

http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard

The FHS applies to Linux, but you'll find it close to what other
Unix-like OSes use too.

It's extremely common to *read* config files from directories like
/etc, but to require root privileges to edit them. If you need to
store data files for some application that runs as your own user, one
good place is a dot-file or directory in your home directory - for
instance, I have:

/home/rosuav/.wine/
/home/rosuav/.bash_history
/home/rosuav/.ssh/
/home/rosuav/.SciTE.session

and many more. All of these are happily read/written by processes
running under the user 'rosuav' (my primary login user). If a
different user fires up bash, a different .bash_history will be used.
This system works well for users that represent humans.

The other type of user is the one that, well, doesn't represent a
human :) Figuring out where they can store files is a bit harder.
PostgreSQL gets itself a directory somewhere - maybe /opt/postgresql,
maybe /var/lib/postgresql - and restricts itself to that. But the
directory is created by root and then handed over (chowned) to the
other user.

Both these options work well; random processes editing stuff in /etc doesn't :)

ChrisA

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