Visit Our UNIX and Linux User Community


Monitoring umask execution


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Monitoring umask execution
# 1  
Old 10-15-2009
Monitoring umask execution

Good Day!

I would like to ask, is there a way to find out the list of users or scripts that executed a umask command for a given time? Our server has been having issues about files being written with 000 access, and we need to find out if it's because someone or some code is playing around with umask.

Any kind of help would be appreciated.
# 2  
Old 10-15-2009
Simple, for example: I would want to find out the process id, and user who executes the "w" command.

1. By default

Code:
w output

2. move the w to w.org

Code:
mv /usr/bin/w /usr/bin/w.org

3. Write your own w

Dont worry, it is simple.
Code:
#!/bin/sh

echo "Process ID: $$";
echo "Login Name: $LOGNAME";

/usr/bin/w.org

This will print the required information, and then calls the original w.

4. Thus how you can do it.
You need to redirect the output to a log file, if need be and analyze it.

Hope i had given enough way to troubleshoot your issue.
# 3  
Old 10-16-2009
The method proposed by "thegeek" will not work for "umask" unless it is called as /usr/bin/umask. The "umask" command is built into all the main shells on HP-UX.

Further to your previous thread:

Unix File has 000 access when written

Have you checked the kernel parameters? Particularly any to do with maximum number of open files or maximum number of file locks. I have seen files on HP-UX with permissions 000 after a program died silently due to exceeding a kernel parameter.
Some key kernel parameters visible in "sar" (look for figures in the ov=overflow columns), but HP "glance" is better.
Code:
sar -v

# 4  
Old 10-16-2009
I would add:
What makes you think it has something to do with umask and not chmod? (Ive seen developers do so with chmod...)
# 5  
Old 10-18-2009
Quote:
Originally Posted by vbe
I would add:
What makes you think it has something to do with umask and not chmod? (Ive seen developers do so with chmod...)
I thought that was so, because for all instances of the 000 access (there have been four within 2 months), it happened exactly after the file was written, disabling all other future reads to it. The process that writes those files are completely automatic, so I am doubtful that someone had perfect timing to execute chmod just exactly when the file was written.


Quote:
Originally Posted by methyl
The method proposed by "thegeek" will not work for "umask" unless it is called as /usr/bin/umask. The "umask" command is built into all the main shells on HP-UX.

Further to your previous thread:

Unix File has 000 access when written

Have you checked the kernel parameters? Particularly any to do with maximum number of open files or maximum number of file locks. I have seen files on HP-UX with permissions 000 after a program died silently due to exceeding a kernel parameter.
Some key kernel parameters visible in "sar" (look for figures in the ov=overflow columns), but HP "glance" is better.
Code:
sar -v

Thanks, I will look more into the sar command, as it is my first time to hear about it. Do you mean that you saw a 000 file after a program died after exceeding a kernel parameter, and that program was writing the file? Or could it possibly be another program that died, and affected the writing of another program?
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #331
Difficulty: Medium
The last Windows operating system to be based on the Windows 9x kernel was Windows 98.
True or False?

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Umask help!

Hi guys, I want all new files and directories created, or copy file give this permisson "rwxrwx---", with chmod i do this with octal value "770". If i execute "umask 770" the permissons is not the same with new or copy file. How can i configure this command? I do not understand the "man... (1 Reply)
Discussion started by: Xedrox
1 Replies

2. AIX

UMASK

How do I change the umask for a NIS user? Thanks steve (1 Reply)
Discussion started by: steve.lavoie
1 Replies

3. Shell Programming and Scripting

Expect Issue Serial Forground Execution vs Concurrent Background Execution

I have an expect script that interrogates several hundred unix servers for both access and directories therein using "ssh user@host ls -l /path". The combination of host/path are unique but the host may be interrogated multiple times if there are multiple paths to test. The expect script is run... (2 Replies)
Discussion started by: twk
2 Replies

4. UNIX for Advanced & Expert Users

umask

Hi, Please, let me know how the umask is working? As per my understanding is aprt from subtracting from 666/777, logical gate operation is performing. Ex: If I set uname 011, it gave the permission like 666 for file. Request you to explain which gate's operation performed. $uname 011... (4 Replies)
Discussion started by: Nagapandi
4 Replies

5. Solaris

umask

Due to urgent requirement to resolve some permission issues , I wish to set solaris 8 server so that any file written is on 777 . I guess need to set umask , how to set it ?? (7 Replies)
Discussion started by: falcon16
7 Replies

6. UNIX for Dummies Questions & Answers

umask

Hi, I have a doubt on the umask values. Why is the UMASK value is different from file and directory? Suppose if the umask value is 0022. The file permissions for a newly created file is 644 and the file permissions for a newly created directory is 755. My doubt is why can't it be the... (1 Reply)
Discussion started by: praveen_b744
1 Replies

7. Linux

help on umask

hai guys , i am having problem in getting the knowledge about umask. actually when i am putting command as umask some value is coming like 0022 by defalut. we can change its value also. but the main thing is thye file permisiion actually depends upon umask.how is it depends upon umask i want to... (6 Replies)
Discussion started by: suvendu4urs
6 Replies

8. UNIX for Dummies Questions & Answers

umask

the umask on solaris must return 022 or 0022 wich one is correct and why? thanks, pa (2 Replies)
Discussion started by: rsh
2 Replies

9. UNIX for Dummies Questions & Answers

umask

in this unix book that i have, it says: the statement: filedes = open(pathname, O_CREAT, mode); is actually filedes = open(pathname, O_CREAT, (~mask)&mode); /* ~ is the negation symbol */ like it's doing some type of masking. for example, fd =... (1 Reply)
Discussion started by: bb00y
1 Replies

Featured Tech Videos