Sponsored Content
Top Forums Shell Programming and Scripting Script to find the user of a file and permissions Post 302444571 by methyl on Thursday 12th of August 2010 06:51:29 AM
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

 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
CHGRP(3)								 1								  CHGRP(3)

chgrp - Changes file group

SYNOPSIS
bool chgrp (string $filename, mixed $group) DESCRIPTION
Attempts to change the group of the file $filename to $group. Only the superuser may change the group of a file arbitrarily; other users may change the group of a file to any group of which that user is a member. PARAMETERS
o $filename - Path to the file. o $group - A group name or number. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 Changing a file's group <?php $filename = 'shared_file.txt'; $format = "%s's Group ID @ %s: %d "; printf($format, $filename, date('r'), filegroup($filename)); chgrp($filename, 8); clearstatcache(); // do not cache filegroup() results printf($format, $filename, date('r'), filegroup($filename)); ?> NOTES
Note This function will not work on remote files as the file to be examined must be accessible via the server's filesystem. Note When safe mode is enabled, PHP checks whether the files or directories being operated upon have the same UID (owner) as the script that is being executed. SEE ALSO
chown(3), chmod(3). PHP Documentation Group CHGRP(3)
All times are GMT -4. The time now is 04:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy