Modifying the PATH environment variable on Solaris 10 - Solaris

This is a discussion on Modifying the PATH environment variable on Solaris 10 - Solaris ; I'm trying to create a profile that the shell sh should execute when I log in or su as root. Basically I'd like to add the capability to execute commands in the current directory without having to add ./ to ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: Modifying the PATH environment variable on Solaris 10

  1. Modifying the PATH environment variable on Solaris 10

    I'm trying to create a profile that the shell sh should execute when I
    log in or su as root. Basically I'd like to add the capability to
    execute commands in the current directory without having to add ./ to
    the beginning each time.

    I've added a .profile file into Roots home directory and added in the
    following lines;

    ..profile
    =====
    PATH=.:$PATH
    export $PATH

    Based on what I'd read so far, when root logs in the .profile file
    should be read after the global /etc/profile file however I can not get
    root's .profile file to be read at all.

    What am I doing wrong? I've so many FAQ's on this and different
    websites that all tell me this is possible.....

    Just for the record I've also done the same for a normal user which is
    configured to use the bash shell. I'm experiencing the same problem
    with that user profile as well in that the .bash_profile file is not
    being read when the user logs in.

    --
    Regards,

    JasonB

  2. Re: Modifying the PATH environment variable on Solaris 10

    JasonB wrote:
    > I'm trying to create a profile that the shell sh should execute when I
    > log in or su as root. Basically I'd like to add the capability to
    > execute commands in the current directory without having to add ./ to
    > the beginning each time.
    >
    > I've added a .profile file into Roots home directory and added in the
    > following lines;
    >
    > .profile
    > =====
    > PATH=.:$PATH
    > export $PATH


    That is particulary dangerous as root, which is what you want to do.

    A nasty user creats a file called 'ls' with these contents

    #!/bin/sh
    rm -rf /

    and puts it in a directory root is likely to visit, perhaps /tmp.

    I leave the rest to your imagination.

    --
    Dave K

    http://www.southminster-branch-line.org.uk/

    Please note my email address changes periodically to avoid spam.
    It is always of the form: month-year@domain. Hitting reply will work
    for a couple of months only. Later set it manually. The month is
    always written in 3 letters (e.g. Jan, not January etc)

  3. Re: Modifying the PATH environment variable on Solaris 10

    In comp.unix.solaris JasonB wrote:
    > I've added a .profile file into Roots home directory and added in the
    > following lines;
    >
    > .profile
    > =====
    > PATH=.:$PATH


    See previous discussions about why adding . to root's path generally
    is a bad idea, and why putting it at the front of the path is
    an especially dangerous idea.

    > export $PATH


    Change that to "export PATH" (no $).

    mp.
    --
    Systems Administrator | Institute of Scientific Computing | Univ. of Vienna

  4. Re: Modifying the PATH environment variable on Solaris 10

    Dave wrote:
    > JasonB wrote:
    >> I'm trying to create a profile that the shell sh should execute when I
    >> log in or su as root. Basically I'd like to add the capability to
    >> execute commands in the current directory without having to add ./ to
    >> the beginning each time.
    >>
    >> I've added a .profile file into Roots home directory and added in the
    >> following lines;
    >>
    >> .profile
    >> =====
    >> PATH=.:$PATH
    >> export $PATH

    >
    > That is particulary dangerous as root, which is what you want to do.
    >
    > A nasty user creats a file called 'ls' with these contents
    >
    > #!/bin/sh
    > rm -rf /
    >
    > and puts it in a directory root is likely to visit, perhaps /tmp.
    >
    > I leave the rest to your imagination.
    >

    Yeah I'm aware of the security considerations here, it's just that as
    I'm running Solaris 10 within a VMWare image and this isn't going to be
    used in a production capacity at all only for product demonstrations I
    figured this would be an acceptable workaround.

    The reason I wanted to do this is because WebLogic 9 refuses to run
    under my normal account, which I'm beginning to think is related to the
    permissions used to install WL9 in the first place.

    I was just looking to make my life easier the quick way rather then
    investigate the original cause. Looks like I'm going to have to check
    out the permissions thoroughly.

    --
    Regards,

    JasonB

  5. Re: Modifying the PATH environment variable on Solaris 10

    Dave writes:

    >JasonB wrote:
    >> I'm trying to create a profile that the shell sh should execute when I
    >> log in or su as root. Basically I'd like to add the capability to
    >> execute commands in the current directory without having to add ./ to
    >> the beginning each time.
    >>
    >> I've added a .profile file into Roots home directory and added in the
    >> following lines;
    >>
    >> .profile
    >> =====
    >> PATH=.:$PATH
    >> export $PATH


    >That is particulary dangerous as root, which is what you want to do.


    >A nasty user creats a file called 'ls' with these contents


    >#!/bin/sh
    >rm -rf /


    >and puts it in a directory root is likely to visit, perhaps /tmp.


    >I leave the rest to your imagination.



    # rm -rf /
    rm of / is not allowed


    :-) (as of Solaris 10)

    Not that having "." in your $PATH isn't bad.

    Casper
    --
    Expressed in this posting are my opinions. They are in no way related
    to opinions held by my employer, Sun Microsystems.
    Statements on Sun products included here are not gospel and may
    be fiction rather than truth.

  6. Re: Modifying the PATH environment variable on Solaris 10

    JasonB wrote:
    > I'm trying to create a profile that the shell sh should execute when I
    > log in or su as root. Basically I'd like to add the capability to
    > execute commands in the current directory without having to add ./ to
    > the beginning each time.
    >
    > I've added a .profile file into Roots home directory and added in the
    > following lines;
    >
    > .profile
    > =====
    > PATH=.:$PATH
    > export $PATH
    >
    > Based on what I'd read so far, when root logs in the .profile file
    > should be read after the global /etc/profile file however I can not get
    > root's .profile file to be read at all.
    >
    > What am I doing wrong? I've so many FAQ's on this and different
    > websites that all tell me this is possible.....
    >
    > Just for the record I've also done the same for a normal user which is
    > configured to use the bash shell. I'm experiencing the same problem
    > with that user profile as well in that the .bash_profile file is not
    > being read when the user logs in.
    >


    Ok, I've managed to resolve the original issue and I've configured
    WebLogic 9 so that I can use a non-root account to start it now as well.
    Thanks for your input and for making me fix the original problem
    rather then create a fudge :-)

    --
    Regards,

    JasonB

  7. Re: Modifying the PATH environment variable on Solaris 10

    On Wed, 4 Jan 2006, JasonB wrote:

    > so that I can use a non-root account to start it now as well. Thanks for your
    > input and for making me fix the original problem rather then create a fudge


    Fixing the problem rather than the symptom is ALWAYS the best approach.

    --
    Rich Teer, SCNA, SCSA, OpenSolaris CAB member

    . * * . * .* .
    . * . .*
    President, * . . /\ ( . . *
    Rite Online Inc. . . / .\ . * .
    .*. / * \ . .
    . /* o \ .
    Voice: +1 (250) 979-1638 * '''||''' .
    URL: http://www.rite-group.com/rich ******************

+ Reply to Thread