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

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 2013-06-01 00:42 +1000
Subject Re: Create a file in /etc/ as a non-root user
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2491.1370011335.3114.python-list@python.org> (permalink)

Show all headers | 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