[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: login, path and ~/.profile



On Fri, Sep 30, 2005 at 08:50:05AM +0200, Benedict Verheyen wrote:
> Hi,
> 
> i was looking to change the prompt of a UML and while i was at it i 
> noticed something in regards to the path that is set.
> When logging in these files are processed (used echo to find out)
> /etc/profile
> /etc/bash.bashrc
> ~/.bash_profile
> ~/.bashrc
> 
> This might differ on your system as I:
> * source /etc/bash.bashrc from /etc/profile
> * source ~/.bashrc from ~/.bash_profile
> 
> When doing su, these files are executed
> /etc/bash.bashrc
> ~/.bashrc
> 
> As for my questions:
> 1. Why isn't ~/.profile run?

The su command does not launch a login shell, and the login scripts
(/etc/profile and ~/.profile) are only executed by a login shell. That's
the difference between the two.

To get a root login shell, use

    su -

> 2. I'm setting up an UML that i debootstrapped so root is the only way 
> to log on for the moment. When i apt-get i get errors in the end because 
> the /bin /sbin paths aren't set so certain tools aren't found.
> Is it better to leave the path like this security wise or should i just 
> add the /bin and /sbin directories?
> The ~/.profile file contains a decent PATH but as this file doesn't seem 
> to get executed, the path isn't set.

I don't have any experience with UML (and I just guess you mean "User
Mode Linux", rather than "Unified Modelling Language"), but, at any rate,
simply "su -" should get you the standard root PATH and other environment
settings.

Best regards, Jan
-- 
 +- Jan T. Kim -------------------------------------------------------+
 |    *NEW*    email: jtk@cmp.uea.ac.uk                               |
 |    *NEW*    WWW:   http://www.cmp.uea.ac.uk/people/jtk             |
 *-----=<  hierarchical systems are for files, not for humans  >=-----*



Reply to: