When a script runs in background that is creating copy of it with the parent process id in /tmp directory, ofcourse this copy is getting removed soon after the process is done, however during this run time any user has access to server they can view credentials.
My question is how can I change this behavior creating a copy in /tmp directory? if it can't be changed, how can I make sure there is only 640 permissions on the copy in /tmp directory.
Below is the script that runs in background with PID:32702884 there is a copy created in /tmp directory with sh32702884.1, any user can cat this file and see if any credentials. Please advice.
oracle@orcl:/users/cmsc/oracle>nohup ./rman_del_obsolete_090616.ksh>rman_del_obsolete_090616.ksh.log &
[1] 32702884
oracle@orcl:/users/cmsc/oracle>ps -ef|grep ksh
oracle 32702884 21627666 0 16:23:16 pts/0 0:00 sh -- ./rman_del_obsolete_090616.ksh
oracle@orcl:/users/cmsc/oracle>cd /tmp
oracle@orcl:/tmp>ls -ltr sh*
-rwxrwxrwx 1 root system 3340 Jan 03 2012 sharch_root.sh
-rwxrwxrwx 1 ctmagent controlm 3340 Jan 03 2012 sharch_ctmagent.sh
-rw-r--r-- 1 oracle cdba 343185 Sep 06 16:23 sh32702884.1
oracle@orcl:/tmp>head sh32702884.1
connect target /
connect catalog xxdfd/sscsxxxx@db1
run{
delete force noprompt backuppiece 'RMAN-ORV1-ARCH-20160718-474184-1';
delete force noprompt backuppiece 'RMAN-ORV1-ARCH-20160718-474180-1';
delete force noprompt backuppiece 'RMAN-ORV1-ARCH-20160718-474179-1';
delete force noprompt backuppiece 'RMAN-ORV1-ARCH-20160718-474183-1';
delete force noprompt backuppiece 'RMAN-ORV1-ARCH-20160717-474066-1';
delete force noprompt backuppiece 'RMAN-ORV1-ARCH-20160717-474063-1';
oracle@orcl:/tmp>
oracle@orcl:/users/cmsc/oracle>head rman_del_obsolete_090616.ksh rman<<EOF connect target / connect catalog xxdfd/sscsxxxx@db1 run{ – user188577 Sep 06 '16 at 20:56
/tmp
even after script termination. – Chris Davies Sep 06 '16 at 21:30