[OT] Problems with permissions etc

Martin Franklin mfranklin1 at gatwick.westerngeco.slb.com
Wed Jul 27 10:00:28 CEST 2005


Hi Frank,

Frank Millman wrote:
> Hi all
> 
> This is not strictly a Python question, but this newsgroup feels like a
> family to me, so I hope that someone will be kind enough to respond to
> this, or at least point me in the right direction.
> 
> While developing under linux, I use my own computer, as the only user,
> so it has become my habit to login as root and do all my work as a
> superuser. I know that this is not desirable, but it has become a
> habit, which I am now trying to get out of.
> 

Good.

Most 'problems' I have running this kind of system at home can be fixed 
by adding your user account to the /etc/sudoers file like so:-

martin      ALL=(ALL) ALL


so every now and then when I need to do somthing as root I just sudo
(and enter *my* password)

Linux distros such as ubuntu use this scheme and I think MAC OS X does
too.

> Now that I am logging in as an ordinary user, I find that a number of
> things that previously 'just worked' have now stopped working. I can
> usually find the cause, and tweak whatever is needed to get it working
> again, but I am wondering how most people work. Is it normal to
> experience these kinds of problems, or am I missing a trick somewhere
> and making my life more complicated than it need be?
> 
> I will give two examples. I would like advice on the best way to fix
> them, but I would prefer a more general reply that explains how
> experienced unix/linux users go about handling these kinds of issues.
> 
> 1. The application I am developing will eventually be deployed as a
> multi-user accounting/business system. I want to identify the physical
> workstation that generates each transaction, so I am using the mac
> address. My method for extracting this is as follows -
> 	mac = os.popen("ifconfig|grep Ether|awk {print '$5'}").read()[:-1]  #
> I did not come up with this myself, I cribbed it from somewhere
> As root, this works fine. As non-root, ifconfig is not found. The
> reason is that it is in /sbin, and this is not included in the default
> path for non-root users. I could either include /sbin in my path, or I
> could change the above line to /sbin/ifconfig ... Alternatively, there
> may be a better way of getting the mac address or identifying the
> workstation.
> 

Since you are relying on ifconfig anyway I would just stick the fully
qualified pathname (/sbin/ifconfig) into the python code



> 2. I am using wxPython, which was compiled from source. It so happens
> that I did this with a colleague who also has a user account on my
> machine, so the compile and install of wxPython was done from his home
> directory.
> 
> When I start my app as non-root, the import of wx fails, as it cannot
> find certain files. They are in the other user's home directory, but as
> the top-level directory has permissions of drwx------, my user cannot
> read anything in that directory. I can change the directory
> permissions, or I can move the files to another area which all users
> can read. If the latter, is there a 'correct' place to put them?
> 


Re-compile and or install wxPython as root, this will install it into a
default place (/usr/local or wherever) and you will not need to worry
about permissions.


> I think that these problems are a result of my lack of experience as a
> system administrator. On the other hand, the various books and articles
> I have read to try and improve my knowledge have not covered these
> kinds of issues. Is it just something that one learns the hard way?
> 
> Any advice, especially pointers to reading matter that covers this
> topic, will be much appreciated.
> 
> Thanks
> 
> Frank Millman
> 

Cheers
Martin




More information about the Python-list mailing list