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

rusi rustompmody at gmail.com
Sat Jun 1 00:39:54 EDT 2013


On May 31, 7:42 pm, Chris Angelico <ros... at gmail.com> wrote:
> On Sat, Jun 1, 2013 at 12:02 AM, Alister <alister.w... at 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.

Yes the FHS is a good center for such discussions.  Let me expand on
this a bit.

I am going to use debian/ubuntu+apt because I know it a bit. You can
substitute RH/Centos+yum or whatever...

Modern linuxes are SOAs (service oriented architectures) or cloud
architectures even if we dont like the buzzwords.

This means that when I install debian/ubuntu on my personal computer
there is some kind of contract-ing that goes on between me and
debian.  Some of it legal, some semi-legal some entirely informal/
conventional but still very important.

Legal:
For example it may be 'my very own computer' but if I take sources
under a certain license and use them in violation of that license I
could get into legal trouble.

Semi-legal:
Free and not-free software can coexist in ways that are at least
legally nebulous

Conventional:
Debian must not use the machine (and file-system in particular) in
ways that disrespect me.
Note I am not talking of obvious legal gaffes like stealing my private
data but of more 'conventional' problems like strewing my home
directory with meaningless temporary files.

Likewise:
I MUST RESPECT Debian's AREA.
For example I cant go messing about in /usr/bin [the name 'usr' is
misleading and unfortunate] and expect support from debian.
So
$ sudo rm /usr/bin/foo
is improper whereas
$ sudo apt-get purge foo
is proper.

And its improper because you are not to mess around in debian's area
-- except for officially approved channels like 'apt-get purge…' --
just as debian is not to mess around in yours.

And writing into /etc constitutes messing with debian (or whatever is
your distro).

So yes, as Chris suggested read the FHS.

And consider using a 'public-messable' area like /usr/local instead
of /etc.

Actually the situation is more complicated: the deal is not between
just ordinary users like you/me and the distro. There's
- ordinary users like you/me
- packagers
- the distro
- upstream

each with their own rights and responsibilities.
What these are and how to navigate them is best discussed in your
distro's fora eg
http://forums.debian.net/
http://ubuntuforums.org/forum.php



More information about the Python-list mailing list