04-10-2005
K-ONE,
A simple find can do it. For example, if you wanted to remove the write bit for "others":
find . -type f -perm -o+w -exec chmod o-w {} \;
Cheers,
Keith
10 More Discussions You Might Find Interesting
1. Solaris
Hi,
I was wondering if there is any way to find out when the file/directory's permissions were changed. Typically, when using 'chmod' to change a file/directory's permissions, the modification date does not change.
Any help would be greatly appreciated.
Thanks. (4 Replies)
Discussion started by: kpatel
4 Replies
2. Shell Programming and Scripting
Hi,
I have a script called check.sh. I have to pass a file as input to this script. How can I validat whether the file has read permissions or not within the script.
Thanks in advance (1 Reply)
Discussion started by: sendhilmani123
1 Replies
3. Shell Programming and Scripting
Hi,
Is their a way to check the read and execute permission on a file on OTHERS and GROUP
rwxr--r-x
I am trying something like:
if ( || )
then
....
fi
The code above only checks the permissions of the owner of the file but not for the GROUP and OTHERS.
I will really... (5 Replies)
Discussion started by: rkumar28
5 Replies
4. Shell Programming and Scripting
I am running a linux centos server; our php script generates plenty of files in a directory, anything up to 1000 (though too often more).The files in these directories have permissions and ownerships which i need to change.
I have used shell comment for changing the file permission which is... (1 Reply)
Discussion started by: nilson
1 Replies
5. UNIX for Dummies Questions & Answers
Hi,
Is there any way to unzip a zip file and change file permissions to 777 while extracting the files. Does the file permissions on the zip file has to do anything with it(like zip read permissions only result in read uncompressed files etc.,)?
Thanks,
jp (2 Replies)
Discussion started by: jpk
2 Replies
6. UNIX for Advanced & Expert Users
Hi there,
I need to change all files/dirs
1. all files with 744
2. all dirs with 755
is there a script for that ?
thanks,
thegunman (13 Replies)
Discussion started by: TheGunMan
13 Replies
7. Shell Programming and Scripting
Hi All,
I am trying to wite a Shell script which changes the permission of the files in a folder but stuck at a particular point,please help.
The scenario is as follwoing:
I am having a list of 10 files and a folder which has 100 files.
I need to copare the list and the folder ,for... (4 Replies)
Discussion started by: Sriram.Vedula53
4 Replies
8. UNIX for Dummies Questions & Answers
while trying to view the access permissions to file by "ls -lrt" command it is opening some files int the dir after that segmentation fault ie core is generarting the dir.will anybody please what is the problem. (1 Reply)
Discussion started by: rajkumar_g
1 Replies
9. Shell Programming and Scripting
Hi, I am creating a ksh script to search for a string of text inside files within a directory tree. Some of these file are going to be read/execute only. I know to use chmod to change the permissions of the file, but I want to preserve the original permissions after writing to the file. How can I... (3 Replies)
Discussion started by: right_coaster
3 Replies
10. UNIX for Beginners Questions & Answers
Hi All,
Apologies if this question has been asked before. I havent been able to resolve an issue and would like some help.
I am getting files pushed to me via sftp. The files once pushed to my server in folder ABC have -rw------- but I need these files to have the following -rw-rw---- to be... (1 Reply)
Discussion started by: israr75
1 Replies
OPEN(2) System Calls Manual OPEN(2)
NAME
open, create, close - open a file for reading or writing, create file
SYNOPSIS
#include <u.h>
#include <libc.h>
int open(char *file, int omode)
int create(char *file, int omode, ulong perm)
int close(int fd)
DESCRIPTION
Open opens the file for I/O and returns an associated file descriptor. Omode is one of OREAD, OWRITE, ORDWR, or OEXEC, asking for permis-
sion to read, write, read and write, or execute, respectively. In addition, there are three values that can be ORed with the omode: OTRUNC
says to truncate the file to zero length before opening it; OCEXEC says to close the file when an exec(2) or execl system call is made; and
ORCLOSE says to remove the file when it is closed (by everyone who has a copy of the file descriptor). Open fails if the file does not
exist or the user does not have permission to open it for the requested purpose (see stat(2) for a description of permissions). The user
must have write permission on the file if the OTRUNC bit is set. For the open system call (unlike the implicit open in exec(2)), OEXEC is
actually identical to OREAD.
Create creates a new file or prepares to rewrite an existing file, opens it according to omode (as described for open), and returns an
associated file descriptor. If the file is new, the owner is set to the userid of the creating process group; the group to that of the
containing directory; the permissions to perm ANDed with the permissions of the containing directory. If the file already exists, it is
truncated to 0 length, and the permissions, owner, and group remain unchanged. The created file is a directory if the CHDIR bit is set in
omode. It is an exclusive-use file if the CHEXCL bit is set. Such files may be open for I/O by only one client at a time, but the file
descriptor may become invalid if no I/O is done for an extended period; see open(5).
Create fails if the path up to the last element of file cannot be evaluated, if the user doesn't have write permission in the final direc-
tory, or if the file already exists and does not permit the access defined by omode. If the file is new and the directory in which it is
created is a union directory (see intro(2)) then the constituent directory where the file is created depends on the structure of the union:
see bind(2).
Close closes the file associated with a file descriptor. Provided the file descriptor is a valid open descriptor, close is guaranteed to
close it; there will be no error. Files are closed automatically upon termination of a process; close allows the file descriptor to be
reused.
SOURCE
/sys/src/libc/9syscall
SEE ALSO
intro(2), bind(2), stat(2)
DIAGNOSTICS
These functions set errstr.
OPEN(2)