Sponsored Content
Top Forums Shell Programming and Scripting MV file with other permission Post 302903085 by Don Cragun on Saturday 24th of May 2014 04:40:08 AM
Old 05-24-2014
Quote:
Originally Posted by Aia
chgrp will change the group ownership of the file, not the permissions



A file with rw-rw-r allows the owner, and the group owner to read, write (and delete), but only read to any one else.

Code:
chmod o+w filename

That would change the permissions for all others to allow to write (and delete) which is the equivalent of mv

Another option is to give access to the file via the group of the application. Changing the group ownership of the file

Code:
chgrp <application_group> <filename>

Not really.

Moving a file within a single filesystem doesn't require any permissions at all on the file being moved. You just need search permissions on the pathname prefix for the source and destination directories, and search and write permission on the final component of the source and destination directories. If you're moving across file system boundaries you also need read and write access to the file being moved. (If you don't have write permission and you don't specify the -f option or you do specify the -i option to mv, mv will ask you to confirm that you really want to move a file if you don't have write permission, but if you respond affirmatively you will be allowed to move the file even if it has mode 0 and you don't own it as long as you have the permissions needed to create the new link in the destination directory and to delete the old link from the source directory.)
This User Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

The file permission

I have a file ( /tmp/file.txt ) , the file owner is user1:edp , the permission is 644 , I want everyone can overwrite the file but don't change the file owner and permssion , could suggest what can I do ? thx (2 Replies)
Discussion started by: ust
2 Replies

2. Shell Programming and Scripting

The file permission

there is a directory eg. /home/edp/ , all the files under this directory : 1. the file and directory owner is "user1" , 2. the permission is 644 I want everyone hv permission to overwrite all files and write a new file to it , but I want the file owner and permssion keep unchange , could... (1 Reply)
Discussion started by: ust
1 Replies

3. Solaris

File permission

Hi Folks I have a file with the following permission. -r-sr-lr-- 1 apps appsgp 7612 Dec 19 2001 startup Any idea what is the in the group means? In my mind I believe I need to be root to set l in the group. Am I right? I don't have root access now. When I (as apps) a chmod... (2 Replies)
Discussion started by: hlee411
2 Replies

4. UNIX for Dummies Questions & Answers

File Permission

Hi, When I listed one directory in Sun, it showed that : -rwsr-xr-x 1 root bsmbin 78004 Oct 21 2004 bsmprsm I don't know meaning of the character "s" in "rws" above. I have searched in Sun admin documents but no result. Would you please explain it ? :) Thank you so much. (1 Reply)
Discussion started by: msg098
1 Replies

5. Cybersecurity

file permission/acl: 2 users with write access on 1 file...

Hello, i need some help/advice on how to solve a particular problem. these are the users: |name | group | ---------- --------------- |boss | department1 | |assistant | department1 | |employee | department1 | |spy | department2 | this is the... (0 Replies)
Discussion started by: elzalem
0 Replies

6. Solaris

file permission

hi frnds can u explain /etc/shadow file have read and write permissions for root only but while normal user changes his passwd it also updated in that file whats the logic behind that. (2 Replies)
Discussion started by: sravan ega
2 Replies

7. Shell Programming and Scripting

file permission

Hi All, https://www.unix.com/unix-advanced-expert-users/105758-chmod-parent-sub-directories.html I have to change permission for the directories and subdirectories in single command when googled i found some updates but i understand what is switch. If there is a command please... (2 Replies)
Discussion started by: thelakbe
2 Replies

8. Shell Programming and Scripting

File permission

I have an application with the user mark and another user james is trying to run the application and ending up with file permission issues. The user mark has set the umask as 002, I wanted to have a setting so that anyone can run the application without any file permission issues. Can anyone... (2 Replies)
Discussion started by: Muthuraj K
2 Replies

9. Ubuntu

File permission

Hi Friends, I want to create one user on my server in such a way that when he logged in by ssh on server,he can able to access ONLY /var/www/drupal-6.2 this directory. Please tell me how should i do that. (4 Replies)
Discussion started by: paragnehete
4 Replies

10. HP-UX

File permission

Hi, Could you please tell me the OS command to grant as similar to below permission? rwxrwxr-x OS -- HP-UX Regards, Maddy (8 Replies)
Discussion started by: Maddy123
8 Replies
chmod(2)							System Calls Manual							  chmod(2)

NAME
chmod, fchmod - Changes file access permissions SYNOPSIS
#include <sys/mode.h> #include <sys/types.h> #include <sys/stat.h> int chmod ( const char *path, mode_t mode ); int fchmod ( int filedes, mode_t mode ); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: chmod(), fchmod(): XSH5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the full pathname of the file. If the path parameter refers to a symbolic link, the chmod() function changes access permissions on the file specified by the symbolic link. Specifies the file descriptor of an open file. Specifies the bit pattern that determines the access permissions. DESCRIPTION
The chmod() function sets the access permissions of the file specified by the path parameter according to the bit pattern specified by the mode parameter. The fchmod() function sets the access permissions of an open file pointed to by the filedes parameter according to the bit pattern speci- fied by the mode parameter. To change file access permissions, the process must have the same effective user ID as the owner of the file or the process must have supe- ruser privilege. Upon successful completion, the chmod() and fchmod() functions mark the st_ctime field of the file for update. The mode parameter is constructed by logically ORing one or more of the following values, which are defined in the sys/mode.h header file: Sets the process' effective user ID to the file's owner on execution. Sets the process' effective group ID to the file's group on execu- tion. Saves text image after execution. Permits the file's owner to read, write, and execute it (or to search the directory). Permits the file's owner to read it. Permits the file's owner to write to it. Permits the file's owner to execute it (or to search the direc- tory). Permits the file's group to read, write, and execute it (or to search the directory). Permits the file's group to read it. Per- mits the file's group to write to it. Permits the file's group to execute it (or to search the directory). Permits others to read, write, and execute it (or to search the directory). Permits others to read the file. Permits others to write to the file. Permits others to execute the file (or to search the directory). Other mode values exist that can be set with the mknod() function, but not with the chmod() function. If the mode bit S_ISGID is set and the mode bit S_IXGRP is not set, mandatory file record locking will exist on a regular file. This may affect subsequent calls to other calls on the file, including open(), creat(), read(), write(), and truncate(). The S_ISGID bit of the file is cleared if: The file is a regular file. The effective user ID of the process does not have appropriate sys- tem privilege. The effective group ID or one of the IDs in the group access list of the process does not match the file's existing group ID. RETURN VALUES
Upon successful completion, the chmod() and fchmod() functions return a value of 0 (zero). If the chmod() or fchmod() function fails, a value of -1 is returned, and errno is set to indicate the error. ERRORS
If the chmod() function fails, the file permissions remain unchanged and errno may be set to one of the following values: A component of the path parameter has search permission denied. The path parameter points to a location outside of the allocated address space of the process. A signal was caught during execution of the system call. The file is not a regular file. Too many symbolic links were encoun- tered in translating the path parameter. The length of the path argument exceeds PATH_MAX or a pathname component is longer than NAME_MAX. The named file does not exist or is an empty string. A symbolic link was named, but the file to which it refers does not exist. A component of the path parameter is not a directory. The effective user ID does not match the ID of the owner of the file or the owner does not have appropriate system privilege. The named file resides on a read-only file system [Tru64 UNIX] The process' root or current directory is located in a virtual file sys- tem that has been unmounted. If the fchmod() function fails, the file permissions remain unchanged and errno may be set to one of the following values: The file descriptor filedes is not valid. A signal was caught during execution of the system call. The effective user ID does not match the ID of the owner of the file, and the calling process does not have superuser privilege. The file referred to by filedes resides on a read-only file system. [Tru64 UNIX] The process' root or current directory is located in a virtual file system that has been unmounted. RELATED INFORMATION
Functions: chown(2), fcntl(2), getgroups(2), mknod(2), open(2), read(2) setgroups(2) truncate(2) write(2) Commands: chgrp(1), chmod(1) Standards: standards(5) delim off chmod(2)
All times are GMT -4. The time now is 04:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy