1838238 Members
4795 Online
110125 Solutions
New Discussion

Re: Execute the .profile

 
Faizer Jameel
Frequent Advisor

Execute the .profile

Dear All
Users .dtprofile I have uncommented the DTSOURCE line. Also in the .profile of the user I have set the the following in .profile of the users.
alias su="su -".
HISTFILE=/.hist/${HOME}/`who am i|awk '{ print $1}'`-`date +%d:%m:%y.%H:%M`
export HISTFILE
HISTSIZE=500
export HISTSIZE

User logs in through through CDE or any desktop environment [like reflection, xbrowser etc]
When the user su's using "su - root" then the history file records the activities but when he su's using "su root" it does not log his activities in the History file.

How can I get the system to log the activities when he logs through "su root" in the hsitory file.
Thanks
Faizer
2 REPLIES 2
Peter Godron
Honored Contributor

Re: Execute the .profile

Bill Hassell
Honored Contributor

Re: Execute the .profile

The problem is that DTSOURCEPROFILE is an incomplete solution. You want a 'normal' login like telnet. That means first /etc/profile is run, then .profile (for POSIX shells like ksh). What your users are expecting is a 'normal' Unix login which (for POSIX shells) first runs /etc/profile and then .profile (DTSOURCEPROFILE doesn't run /etc/profile). It turns out that the default for all terminal emulators in Xwindows is to startup WITHOUT executing the usual profiles. To fix this, put this into every HOME directory for every user:

echo "*loginShell: true" >> $HOME/.Xdefaults

Now terminal emulators such as hpterm, xterm or dtterm will login as expected and will have the same profiles as a telnet connection. You can also add additional resource settings for the emulators or other Xwindow applications. For example, the contents might look like this:

*loginShell: true
HPterm*scrollBar: true
HPterm*saveLines: 10s
HPterm*background: navy
HPterm*foreground: white
Xterm*background: darkslateblue
Xterm*foreground: white
Xterm*saveLines: 10s
Xterm*scrollBar: true
Dtterm*saveLines: 10s
Dtterm*scrollBar: true

and after adding these lines to .Xdefaults, all hpterm, xterm and dtterm windows will have a scroll bar plus 10 screens (800 lines) of history. hpterm will have a dark blue with white letter color scheme while xterm will have a more gray-blue background with white letters. dtterm will match the overall CDE color scheme.

.Xdefaults is one of the many ways to set window decorations or resources. Look at the man page for hpterm and you'll see the dozens of options and resources that can be set. They can be set generically for every window or they can be set for a window that has a specific title. man X is a start but a good book on Xwindows will also be worthwhile.


Bill Hassell, sysadmin