06-13-2009
Only the owner of a file and the user root (uid=0) are allowed to change the filemode of a file. It doesn't matter if you have write-access or not, execute-rights or not, etc..
If you have to change the filemode of a file owned by user1 via a command issued by user2 you might want to explore sudo and its possibilities.
Regarding your original question: works as designed.
I hope this helps.
bakunin
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi!! Experts,
Is there any way to find the timestamp when the permission of a file was modified?? I mean no change to file contents.. Just the chnage of permissions.
:) (1 Reply)
Discussion started by: jyotipg
1 Replies
2. UNIX for Dummies Questions & Answers
I am creating a file using the UTL_FILE command of oracle. This creates a file with the oracle user id. The file does not have permission for being read by any other user id. Is there a way that I can change this default permission. I tried using umask in the .login. Setting the umask to 022 works... (2 Replies)
Discussion started by: reachsamir
2 Replies
3. UNIX for Dummies Questions & Answers
Hi,
/etc/passwd file has write permission only for the root user.
Now when a normal user changes the its own password using passwd command, how this information has been written to the /etc/passwd file when the user is not having write permission to this file.
~santosh (2 Replies)
Discussion started by: santosh149
2 Replies
4. Solaris
Hi
my directory not accepting any commands. its simply telling permission denied. i tried ( cp, mv, rm ) as roor
i want to set default permissons to this DIR
please find the Logs below.
dr-xr-xr-x 1 root root 1 Jun 1 09:04 AP1_ROP ( original dir)
root> chmod 777... (5 Replies)
Discussion started by: vijayq8
5 Replies
5. AIX
Is there any possible way to give permission to a user to a file whose not a member of that group. Also the permission of the file shouls be given only to that USER but not all OTHERS.
Thanks in Advance for ur replies/suggestions... (5 Replies)
Discussion started by: ksailesh
5 Replies
6. Shell Programming and Scripting
Guys, I need help.
I need to change the .txt file permission after I have reset the file content to 0.
The code that reset the file content to 0 is as follows:
#!/bin/sh
for i in /root/script/*.txt
do
echo "0" > $i
done
However, the file is generated by the apache application,... (3 Replies)
Discussion started by: jasperux
3 Replies
7. UNIX for Dummies Questions & Answers
Hi,
A file is transferred from a Windows server(say username : user1) to Unix server via ftp.
In unix, the permission of the file for a user, say user2 will be "-rw-r-----". Since the user1 is the owner of the file, user2 is not able to change the file permission using chmod.
Is there... (5 Replies)
Discussion started by: merin
5 Replies
8. Shell Programming and Scripting
Hi,
this is the structure of the directory
/local/home/app/cases
under cases directory, below are the sub directories and each directory has files.
/local/home/app/cases/1
/local/home/app/cases/2
/local/home/app/cases/3
/local/home/app/cases/4
File types are .txt .sh and so... (5 Replies)
Discussion started by: lookinginfo
5 Replies
9. Shell Programming and Scripting
I got a problem with the permission of mounted 2TB drive in my Linux/Mint system. All the files in any folder are with 777, which is not what I want.
my fstab line for this disk is:
UUID=90803E0C803DF974 /media/grape/Workspace1_ntfs ntfs auto,users,permissions 0 0 and blkid gave me:
$> blkid
... (4 Replies)
Discussion started by: yifangt
4 Replies
10. Shell Programming and Scripting
Hello,
I am looking for a UNIX shell script which can help me for access restriction.
1) /home/ram, there are number file with .txt extension, which should be only owned "ram" user.
like as below
ls -lrt *.txt
-rwx------ 1 ram dba 11 Jan 4 2015 PASS1.txt
-rwx------ 1 ram dba 10 Jan 4... (8 Replies)
Discussion started by: mr.trilok
8 Replies
rcp(1c) rcp(1c)
Name
rcp - remote file copy
Syntax
rcp [ -p ] file1 file2
rcp [-r] [-p] file... directory
Description
The command copies files between machines. Each file or directory argument is either a remote file name of the form rhost:path, or a local
file name. Local file names do not contain colons (:) or backslashes () before colons.
Note that the command refuses to copy a file onto itself.
If path is not a full path name, it is interpreted relative to your login directory on rhost. To ensure that the metacharacters are inter-
preted remotely, a remote host's path can be quoted by either using a backslash () before a single character, or enclosing character
strings in double (") or single (') quotes.
The command does not prompt for passwords; your current local user name must exist on rhost and allow remote command execution via
The command handles third party copies, where neither source nor target files are on the current machine. Hostnames may also take the form
rname@rhost to use rname rather than the current user name on the remote host. The following example shows how to copy the file foo from
user1@mach1 to user2@mach2:
$ rcp user1@mach1:foo user2@mach2:foo
Note that the file .rhosts on mach2 in user2's account must include an entry for mach1 user1. Also note that it may be necessary for the
person implementing the command to be listed in the .rhosts file for mach1 user1.
By default, the mode and owner of file2 are preserved if file2 already exists. Otherwise, the mode of the source file modified by on the
destination host is used.
Options
-p Preserves the modification times and modes of the source files in its copies, ignoring the
-r Copies files in all subdirectories recursively, if the file to be copied is a directory. In this case the destination must be a
directory.
Restrictions
The command is confused by output generated by commands in a .cshrc file on the remote host. In particular, `where are you?' and `stty:
Can't assign requested address' are messages which can result if output is generated by the startup file.
See Also
ftp(1c), rlogin(1c), rsh(1c)
rcp(1c)