Operating System - HP-UX
1822147 Members
4256 Online
109640 Solutions
New Discussion юеВ

/tmp directory contents not deleted after reboot!!! Why?

 
SOLVED
Go to solution
Govind
Frequent Advisor

/tmp directory contents not deleted after reboot!!! Why?

Hi Everyone
Just ran into this curious issue where the /tmp contents were not deleted on a reboot. Why? Is there some kernel parameter that is controlling this behaviour? Also why is the /tmp having 777 permissions, I thought the sticky bit should be on but to my surprise None of the HPUX workstations had the sticky bit on. Is there a reason for this?
Thanks for letting me know in advance.
Regards
Govind
Dont try to fix something till it Aint Broke...Honesty is not always the best policy.....
11 REPLIES 11
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: /tmp directory contents not deleted after reboot!!! Why?

Deletion of temp files is not automatic. If you want to enable this, cd to /etc/rc.config.d and edit the 'clean_tmps' file. Set CLEAR_TMP=0.

You may want to edit /sbin/init.d/clean_tmps to add any other directories.
If it ain't broke, I can fix that.
Steven E. Protter
Exalted Contributor

Re: /tmp directory contents not deleted after reboot!!! Why?

We have a cron job that does that.

You don't usually do file deletes with the kernel at boot.

Here is copy of a script run by cron that clears /tmp data

Its been in prodcution here for 8 years, and never made a mess.

It includes a function library but when cron runs it that library isn't used, so just change it and run it the way you need.

If you need to run it interactively, just point me and post a request. I've marked the post notify and I'll gladly share the function library.

This guy gets rid of files 7 days and older, that of course is easily adjustable.

P
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Rick Garland
Honored Contributor

Re: /tmp directory contents not deleted after reboot!!! Why?

In the /etc/rc.config.d is a file called clean_tmps - check it out

As to 777 for /tmp this is just what the directory is for, temporary storage location for anyone.
Steven E. Protter
Exalted Contributor

Re: /tmp directory contents not deleted after reboot!!! Why?

Just as I hit enter I realized this was a two part question.

/tmp has 777 permissions so that any user can write there. Its not a place to keep programs and stuff you want to limit access to.

P
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Govind
Frequent Advisor

Re: /tmp directory contents not deleted after reboot!!! Why?

Thanks for your replies guys, But I still didnt get the answer for Why the sticky bit is not turned on the /tmp like other OS. Let me know if anyone knows the reason for that.
Thanks again
Govind
Dont try to fix something till it Aint Broke...Honesty is not always the best policy.....
Uday_S_Ankolekar
Honored Contributor

Re: /tmp directory contents not deleted after reboot!!! Why?

/etc/rc.config.d/clean_tmps file has flag 1 or zero for , If you set 1 for CLEAR_TMP=1 means, remove all files from /tmp at startup

-USA..
Good Luck..
Ed Mitchell_1
Advisor

Re: /tmp directory contents not deleted after reboot!!! Why?

Govind:
vi /etc/rc.config.d/clean_tmps.

change it to read:

CLEAR_TMP=1
if it ain't broke, don't patch it.
James R. Ferguson
Acclaimed Contributor

Re: /tmp directory contents not deleted after reboot!!! Why?

Hi:

HP-UX as standardly issued does not set the sticky bit on /tmp or /var/tmp or for that matter on /usr/local directories. It's one of those things that, once known, you simply correct and add to your installation checklist.

Regards!

...JRF...
Patrick Wallek
Honored Contributor

Re: /tmp directory contents not deleted after reboot!!! Why?

It may be a setting that is unique to workstations. What version of HP-UX are you running? With HP-UX 10.20 and prior, there were differences between HP-UX for Servers (800 series) and Workstations (700 Series).

The sticky bit may not be set on the workstation since workstations are probably considered to be machines where only 1 person is going to log into them, thus no reason to set the sticky bit. This is probably also the reason that workstations used to come with a 2-user license of HP-UX by default.

I don't know all of this to be fact, mind you, this is just my guess, however sound or unsound it may be.
Bill Hassell
Honored Contributor

Re: /tmp directory contents not deleted after reboot!!! Why?

The sticky bit has not been set on /tmp and /var/tmp for as long as I can remember (HP-UX version 6.5 roughly). It is a security problem but thoroughly covered in most Unix security texts. There are a *lot* of changes you'll need to make to tighten security on HP-UX (try: ll /usr/local and as root, type: umask)


Bill Hassell, sysadmin
Govind
Frequent Advisor

Re: /tmp directory contents not deleted after reboot!!! Why?

Thanks everyone for you replies.Patrick Thanks for your thought, but I checked up both on the servers and the client workstations and they still have the same issue. Bill Hasell and James Ferguson Thanks for dessiminating your knowledge about this issue, you answered my question thoroughly. Seems like this a standard security issues since time immemorial with HPUX. Anywayz Have a Great Day and Keep learning New stuff.
Regards
Govind
Dont try to fix something till it Aint Broke...Honesty is not always the best policy.....