Script to find the user of a file and permissions


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to find the user of a file and permissions
# 1  
Old 08-12-2010
Script to find the user of a file and permissions

I have a list of files in a.txt file. For each of the files listed in that file, I would like to obtain the owner of the file and also, the permissions associated with that file.
If possible, the group the owner belongs to as well.
Can someone help me with a script to find that out.
# 2  
Old 08-12-2010
Assuming you use a Bourne-type shell and that a.txt is a normal unix format text file with each line containing only a filename.

Code:
cat a.txt | while read filename
do
       ls -lad "${filename}"
done

Or

Code:
while read filename
do
      ls -lad "${filename}"
done < a.txt

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Script without execute permissions will work for a user?

Please help me to understand the issue: Issue: There are shell scripts in a user home directory (/home/user_1) without execute permissions (rw-r--r--) to owner,group and world These shell scripts were able to execute/work previously but its not working now and it says permission denied or... (2 Replies)
Discussion started by: MSK_1990
2 Replies

2. Shell Programming and Scripting

Script for adding users to file permissions

I need a script to add the following two users ids to the permissions for various files: IIS_WPG and IUSR_CowGirl. I am fairly familiar with scripting but haven't been able to figure out how to do this via a script. Manually doing it is slow. I don't want to create users but only add them to a... (2 Replies)
Discussion started by: Stu Loventhal
2 Replies

3. Windows & DOS: Issues & Discussions

Script for adding users to file permissions

I need a script to add the following two users ids to the permissions for various files: IIS_WPG and IUSR_CowGirl. I am fairly familiar with scripting but haven't been able to figure out how to do this via a script. Manually doing it is slow. I don't want to create users but only add them to a... (2 Replies)
Discussion started by: Stu Loventhal
2 Replies

4. Shell Programming and Scripting

Script to give a user sudo permissions

Can some one please let me know a script which gives the user sudo permissions? Thanks in advance.... (6 Replies)
Discussion started by: Revanth547
6 Replies

5. Shell Programming and Scripting

Changing file permissions of a file created by another user

Hi, I have used expdp for datapump. The .dmp file is created by the "oracle" user. my requirement is to make a zipped file of this .dmp file. What i am trying to do is change the permissions of this .dmp file from 0640 to 0644 and then do a gzip and zip it. Is there any way i can change... (3 Replies)
Discussion started by: qwertyu
3 Replies

6. Shell Programming and Scripting

File permissions for particular user

Hi, How can we assign file permissions for a purticular user, rather than giving to whole group. Thanks. (4 Replies)
Discussion started by: karumudi7
4 Replies

7. Shell Programming and Scripting

How to check file permissions from a script.

hello, I have to write a script to run the other script inside it.So iam planning to write like this? first check the perimissions of the file. Alogorthim ---------- if(!filepermissions == execute) then echo" Permissions denined" else execute the script. file name is : load_mf.sh... (1 Reply)
Discussion started by: rajkumar_g
1 Replies

8. Shell Programming and Scripting

permissions to create log file from script

hi all, have a script which i am using to generate a log file. i use "touch out.log" command to create the file and later on i want to echo lines to this file. for some reason it keeps giving me this error when i try and create the file ; touch: out.log cannot create i have... (3 Replies)
Discussion started by: cesarNZ
3 Replies

9. UNIX for Dummies Questions & Answers

How to find a user's file permissions

Hi. I would like to know if there is any command that could list simple file permissions (like , R , RW..etc) for a given uid/userid and on a given file/dir. (9 Replies)
Discussion started by: ram123
9 Replies

10. UNIX for Advanced & Expert Users

How to find permissions/roles/priveleges of User

Hello Everyone, if we log on to unix server how do we find that what permissions/roles and priveleges are assigned to any particular user. Here i am not talking about the file permissions. Thanks (1 Reply)
Discussion started by: hardesh
1 Replies
Login or Register to Ask a Question