Operating System - HP-UX
1833294 Members
3060 Online
110051 Solutions
New Discussion

Re: Login test thru script.

 
SOLVED
Go to solution
brian_31
Super Advisor

Login test thru script.

Hi team:

I have the following script thru which i find what are the files which are being accessed/written to before a login program.

touch fileA
sleep 15
touch fileB
find / -newera fileA -a ! -newera fileB

But when i run this script against a login $HOME/.profile is not shown. It is obvious that the user's .profile is accessed uopn a login is it not? or am i missing something. The idea is to have a list of all the files that were either read,referenced,written or executed before login. Can someone help?

Thanks
Brian.
7 REPLIES 7
Hai Nguyen_1
Honored Contributor

Re: Login test thru script.

Brian,

Only the files which are CREATED/MODIFIED within that period should show up. As for .profile, it is read only as login. Therefore, its timestamp is unchanged, resulting that it is not shown by the find command.

Hai
Rich Wright
Trusted Contributor

Re: Login test thru script.

I know what you mean, I think I was able to duplicate your problem.
I found that if I added
-name "*" -type f
to the find command it would work.
eg:
find / -name "*" -type f -newera fileA -a ! -newera fileB
brian_31
Super Advisor

Re: Login test thru script.

Hi Rich:

It still does not show .profile. It shows /etc/profile but not .profile.

Thanks
Brian.
Sajid_1
Honored Contributor

Re: Login test thru script.

Hi Brian:

Is this user's default shell POSIX ? If not, then the profile file will be different. Check .login abd .cshrc files if it's cshell
learn unix ..
Sajid_1
Honored Contributor

Re: Login test thru script.

While the user logs in, the $HOME profile will be accessed, but not modified. The newer option will list only the files which were modified after the given file. The option for listing all files which were accessed is -atime.

# man find
learn unix ..
brian_31
Super Advisor

Re: Login test thru script.

Hi:

newera option should show the accessed file.

Thanks
Brian.
Rich Wright
Trusted Contributor
Solution

Re: Login test thru script.

Here is what I see. It depends on the default shell for the user that logs in.

For user root with default shell /sbin/sh.
# touch a
# term ## which starts a new session
Starting terminal window on host (TERM=hpterm) ...
# touch b
# find . -name "*" -newera a -a ! -newera b
./.profile
./b

Now for user with /usr/bin/csh default shell.

# touch a
# term ## which starts a new session
Starting terminal window on host (TERM=hpterm) ...
# touch b
# find . -name "*" -newera a -a ! -newera b
./.cshrc
./b
./.kshrc
./.login


I am running HP-UX 11.0

Rich