Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Security issue and temp files Post 302358222 by robsonde on Thursday 1st of October 2009 05:42:26 PM
Old 10-01-2009
Quote:
Originally Posted by mojoman
1) What does the $$ do?
2) Was the senior administrator write about his example concerning symbolic links? Like I said, when I tried it did not work (symbolic link will not overwrite /etc/passwd since it is already there) I was using a test system so no worries...had it overwritten /etc/passwd I would not be in trouble (smile).
1. the $$ is the PID number.
so /tmp/program.$$ becomes /tmp/program.10263 or maybe /tmp/program.542

2. the symbolic link will only let you over write the passwd file if your program is running as root.
is it a risk? yes, but soon as you start writing shell script that run as root you open yourself up to many possable security holes.

his use of mktemp is the right way of doing it, I would recomend you change your script to use it if you can.
if nothing else you will get on his good side :-)
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Tidying up temp files on exit of script

Hi I believe there is a method to remove all temporary files when a KSH script terminates (either expectedly or unexpectedly). I think is some sort of subroutine you can create that runs when the script exits. Can anyone help me with this please? Many thanks Helen :confused: (2 Replies)
Discussion started by: Bab00shka
2 Replies

2. Shell Programming and Scripting

Script to Delete temp files and check file system

Hi all, new to the threads as well as Unix/Linux. I need to create a script that will delete any temporary files as well as check the files on the system for errors or corruption. This is what I have so far and I'm sure that I'm missing things or have the wrong commands. I'm not sure where to go... (3 Replies)
Discussion started by: Bwood1377
3 Replies

3. Shell Programming and Scripting

Joining 3 AWK scripts to avoid use "temp" files

Hi everyone, Looking for a suggestion to improve the below script in which I´ve been working. The thing is I have 3 separated AWK scripts that I need to apply over the inputfile, and for scripts (2) and (3) I have to use a "temp" file as their inputfile (inputfile_temp and inputfile_temp1... (2 Replies)
Discussion started by: cgkmal
2 Replies

4. UNIX for Dummies Questions & Answers

Temp mysql files jamming CPU resources

Hello Friends I am currently facing high CPU usage problem which is making my site extremely slow. Currently I am using a 8GB RAM with 8 cores but, the creation of temporary files is eating away a lot of the CPU resource making the site very slow. The normal CPU load average remains below 2-3... (5 Replies)
Discussion started by: egully
5 Replies

5. Shell Programming and Scripting

temp files

Hi there, As a regular unix user I am forever programming on the command line or writing scripts so that I first write a load of data to a file to read from. In the end I am always left with a bundle of .txt, .tmp which is what I usually call them. As a basic programmmer I was wondering is... (6 Replies)
Discussion started by: cyberfrog
6 Replies

6. Shell Programming and Scripting

Script to temp create files more than inode limit

HI, I am from testing background. I have a scenario of a file generation, through cronjob, on a defined path. After I fill the data as 100 % utilized, my application is generating an empty file on the defined path. # df -kh Filesystem Size Used Avail Use% Mounted on... (3 Replies)
Discussion started by: atulbassi83
3 Replies

7. OS X (Apple)

Safari Temp Internet Files Location

I'm looking for help with finding where plugin data and other page resources are stored on the hard disk in safari 6.0. With the new update, the activity window has been merged into the develop menu under "show page resources" and one cannot access them directly. I tried running opensnoop to see... (3 Replies)
Discussion started by: sakurashinken
3 Replies

8. Shell Programming and Scripting

Backup shell script created temp files .

Hi, I've a script which creates a temp flat file for storing all business dates received on a single day from diff control files sent by source system on that day. e.g on 12th april I receive txns for business day 8,9,10,11 april. I capture this business day and append to a flat file from... (1 Reply)
Discussion started by: manojg9
1 Replies

9. Shell Programming and Scripting

RMTF (ReMove Temp Files)

Heyas As some applications (sed,grep,vi, etc) create some tempfiles, i'd changed a script to this: (sadly i cant find the original post (code) anymore (which just removed 2 'diffrent kinds'), just similar ones - forgot that as i was new to all this) :) ~ $ cat $(which rmtf) #!/bin/sh #... (1 Reply)
Discussion started by: sea
1 Replies

10. Shell Programming and Scripting

Removing large number of temp files

Hi All, I am having a situation now to delete a huge number of temp files created during run times approx. 16700+ files. We have never imagined that we will get this this much big list of files during run time. It worked fine for lesser no of files in the list. But when list is huge we are... (7 Replies)
Discussion started by: mad man
7 Replies
RMUSER(8)						    BSD System Manager's Manual 						 RMUSER(8)

NAME
rmuser -- remove users from the system SYNOPSIS
rmuser [-yv] [-f file] [username ...] DESCRIPTION
The rmuser utility removes one or more users submitted on the command line or from a file. In removing a user from the system, this utility: 1. Removes the user's crontab(1) entry (if any). 2. Removes any at(1) jobs belonging to the user. 3. Sends a SIGKILL signal to all processes owned by the user. 4. Removes the user from the system's local password file. 5. Removes the user's home directory (if it is owned by the user), including handling of symbolic links in the path to the actual home directory. 6. Removes the incoming mail and POP daemon mail files belonging to the user from /var/mail. 7. Removes all files owned by the user from /tmp, /var/tmp, and /var/tmp/vi.recover. 8. Removes the username from all groups to which it belongs in /etc/group. (If a group becomes empty and the group name is the same as the username, the group is removed; this complements adduser(8)'s per-user unique groups.) 9. Removes all message queues, shared memory segments and semaphores owned by the user. The rmuser utility refuses to remove users whose UID is 0 (typically root), since certain actions (namely, killing all the user's processes, and perhaps removing the user's home directory) would cause damage to a running system. If it is necessary to remove a user whose UID is 0, see vipw(8) for information on directly editing the password file. If rmuser was not invoked with the -y option, it will show the selected user's password file entry and ask for confirmation that the user be removed. It will then ask for confirmation to delete the user's home directory. If the answer is in the affirmative, the home directory and any files and subdirectories under it will be deleted only if they are owned by the user. See pw(8) for more details. As rmuser operates, it informs the user regarding the current activity. If any errors occur, they are posted to standard error and, if it is possible for rmuser to continue, it will. The options are as follows: -f file The rmuser utility will get a list of users to be removed from file, which will contain one user per line. Anything following a hash mark ('#'), including the hash mark itself, is considered a comment and will not be processed. If the file is owned by anyone other than a user with UID 0, or is writable by anyone other than the owner, rmuser will refuse to continue. -y Implicitly answer ``yes'' to any and all prompts. Currently, this includes prompts on whether to remove the specified user and whether to remove the home directory. This option requires that either the -f option be used, or one or more user names be given as command line arguments. -v Enable verbose mode. Normally, the output includes one line per removed user; however, with this option rmuser will be much more chatty about the steps taken. username Identifies one or more users to be removed; if not present, rmuser interactively asks for one or more users to be removed. FILES
/etc/master.passwd /etc/passwd /etc/group /etc/spwd.db /etc/pwd.db SEE ALSO
at(1), chpass(1), crontab(1), finger(1), passwd(1), group(5), passwd(5), adduser(8), pw(8), pwd_mkdb(8), vipw(8) HISTORY
The rmuser utility appeared in FreeBSD 2.2. BUGS
The rmuser utility does not comprehensively search the file system for all files owned by the removed user and remove them; to do so on a system of any size is prohibitively slow and I/O intensive. It is also unable to remove symbolic links that were created by the user in /tmp or /var/tmp, as symbolic links on 4.4BSD file systems do not contain information as to who created them. Also, there may be other files cre- ated in /var/mail other than /var/mail/username and /var/mail/.pop.username that are not owned by the removed user but should be removed. The rmuser utility has no knowledge of YP/NIS, and it operates only on the local password file. BSD
May 10, 2002 BSD
All times are GMT -4. The time now is 07:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy