Re: Funny if-condition in the root profile

From: Umberto (umberto.quaia_at_tin.it)
Date: 09/13/05


Date: Tue, 13 Sep 2005 14:49:53 +0200

n.attico@tiscali.it wrote:
> Hi,
>
> I've found in the .profile of the root user on a Sun machine (Sun OS
> for Intel platforms) the following if-condition:
>
> if [ $0 != "ksh" -a $0 != "-ksh" ]
> then
> exec ksh -o vi
> else
> set -o vi
> fi
>
> I understand this is trying to set vi as the shell editor but it's
> unclear to me what it is tryng to test.
>
> Can you understand the purpose of this condition?
>
> TIA
> Nicola Attico
>

An exec in .profile? Definitely bad style, expecially
considering .profile is used both for interactive and
non-interactive shells... Even worse if it's root's.
Good luck when you will try to debug anything!

My advice?

Delete everything and tell sysadmins stop to play with
system files. Root's files should *never* be tweaked.

Default root configuration must stay default root
configuration. Create a directory (profiles, for example)
and put profiles for each user in that directory.
Supposing I am user "umb", I would execute, then:

$ . profiles/.umb

Mario would execute
$ . profiles/.mario

Barry
$ . profiles/.barry

Nicola
4 . profiles/.nicola

And so on.

Everyone has its favourite settings, but system
configuration is unaffected!
There's no bad in personalization, and indeed UNIX gives us
a very flexible environment, however messing up with system
configuration is unadvisable. Just confine user settings and:
1) you will have a default configuration for your scripts
and for OS technical support (imagine the scene: Sun senior
SA comes to solve some weird issue, finds everything messed
up, and loses half an hour just finding how settings are;
and imagine the opinion he/she may have about the local
system administrators...)
2) each system administrator keeps its favourite settings
segregated while being able to activate/reset them up
whenever he/she wants very quickly
3) it's easy to start with the default, standard configuration
4) you will avoid the bad policy that each sysadmin starts
to put in .profile what he/she thinks are the best settings
(for him/her) at the moment
5) you avoid finding every day a different setup (see above)
6) you avoid having each day a different bug in your scripts
7) your backup won't fail because of corrupted .profile

IMO, just point 7 is enough to justify keeping your
configuration untouched.

Actually, there may be settings which may be put in .profile
  without counterindications or tests to be inserted, but I
think that a good methodology is the better choice in the
long term... And it teaches everyone to work well, giving
good example for future similar issues (Oracle user and
every application account).

Only personal users should modify their .profile directly.

Umberto



Relevant Pages

  • Re: Managing IE6 in a Terminal Services Environment
    ... Does the problem occur with new users (newly-created profile)? ... I ask because the IEES doesn't always work well when it needs ... Removing personalized settings for: ... "Not Configured" configuration for users to be able to add sites? ...
    (microsoft.public.windows.terminal_services)
  • Re: OU GPO - Problem setting TS Profile Path for users under a specifi
    ... TS- GPO, settings which should apply to your users when they ... my problem with your advice regarding TS Profile Path ... not as a User configuration (which seems ...
    (microsoft.public.windows.terminal_services)
  • RE: Private settings on my laptop
    ... am still getting the same "can not migrate profile because user settings are ... NOTHING is marked private. ... I understand that you cannot copy profile to domain ... Microsoft CSS Online Newsgroup Support ...
    (microsoft.public.windows.server.sbs)
  • Re: "Classic logon" screen in XP does not remeber the user name
    ... If you used the File and Settings ... that you can access them fine in the profile you want to use them in. ... and log onto a workstation, that workstation immediately goes to a ... you can work from the server and ...
    (microsoft.public.windowsxp.security_admin)
  • Re: Internet Explorercache (further info)
    ... Just for future reference for you...Zone Alarm and Mailwasher are not ... > It is looking more like I will need to delete the profile and then rebuild ... > this saves user settings in IE, OE, My Documents, Mailwasher etc, so in ... > the restore facility in Eazy Backup, it should also put my desktop ...
    (microsoft.public.windows.inetexplorer.ie6.browser)