Change unix permission when I don't own the file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Change unix permission when I don't own the file
# 1  
Old 08-07-2012
Java Change unix permission when I don't own the file

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 anyway that user2 can change the file permission and access it?

Thanks,
Merin
# 2  
Old 08-07-2012
No. Else everybody could do that and so it would be so unsecure, that you would have no need for permissions anymore.
Only root can do this, or if this is an alternative for you, have them both in the same group and set group permissions accordingly to have both users access the file.
This User Gave Thanks to zaxxon For This Post:
# 3  
Old 08-07-2012
If you have root privileges you can

( sudo chmod <mode> <file>

or sudo chown to your username. )

otherwise I would have to say no.
This User Gave Thanks to adrian777uk For This Post:
# 4  
Old 08-07-2012
Quote:
Originally Posted by adrian777uk
If you have root privileges you can

( sudo chmod <mode> <file>

or sudo chown to your username. )

otherwise I would have to say no.
Using sudo doesn't require root privileges. That's rather the point.

Regards,
Alister
This User Gave Thanks to alister For This Post:
# 5  
Old 08-07-2012
If the unix user has root privilages, should the file permission be changed to read/move the file?

---------- Post updated at 06:41 PM ---------- Previous update was at 06:36 PM ----------

Zaxxon, Can I add a windows user and unix user into the same group?
Is that possible??
# 6  
Old 08-07-2012
Explain root privileges please. Does he has the password to become root, a sudo entry to do things as root or another user, or.. ?
If root priviliges are not needed, you might think about using sudo for doing things as user1 as stated above.
Overall, do what you need to do to get it to work for you. But keep the security in mind to have the least needed permissions given to the user. Just in case he get's hacked or something.

Added info (just saw your new post):
Unix doesn't know Windows users. But from what you describe, user1 (Windows) does a ftp transfer to the Unix server. For this he must have a login, which I understood is named user1. If this is the case, user1 must be a user that is placed on the Unix server in it's /etc/passwd. If this was not the case, there would be no permissions like ownership possible for files etc. for this user too.
And when the accounts user1 and user2 exist on the Unix server, you can just create a new group, add both and set group ownership as well as group permissions for the file. Setting the SGID bit onto the directory where the file is transferred to, will inherit the group membership of the directory to the file, which should be set to the group having user1 and user2 of course.

Last edited by zaxxon; 08-07-2012 at 10:26 AM.. Reason: added info - forgot to describe the group
This User Gave Thanks to zaxxon For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need a script to create file permission change restriction

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

2. Shell Programming and Scripting

Change file permission of mounted drive Linux

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

3. Shell Programming and Scripting

Change permission on a file recursively

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

4. Shell Programming and Scripting

Change the file permission

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

5. Shell Programming and Scripting

Change the permission to previously used in unix ( chmod )

I have changed the premission of a file to 777. Now I would like to change permission to previously used ( UNDO ). Is there any command ?:confused: (3 Replies)
Discussion started by: frintocf
3 Replies

6. Solaris

setfacl don't change permission on group owner

I try to use setfacl command to change the permission of the group primary it does not accept the command , it really accept but don't change the permission on the group. the point here I read that if I use chmod command on group primary the mask changed, but if I use setfacl mask should not... (0 Replies)
Discussion started by: hard_revenge
0 Replies

7. Red Hat

httpd : You don't have permission

i have httpd installed on RHEL5 webserver but i have linked #ln -s /rhelREPO /var/www/html/rhel5 /rhelREPO contains all 5cds of RHEL and it is a mount of /dev/sdb1 ip: 192.168.1.133 :works /var/www/html/index.html content is in browser ip: 192.168.1.133/rhel5 :does not work... (1 Reply)
Discussion started by: dplinux
1 Replies

8. AIX

Change file permission by anothere user !

Guy's we are in AIX 5.3 We have created two users user1 and user2 and they are under same group Staff Group user1 will create file under /tmp/ and this is the permission of this file -rw-r--r-- 1 user1 staff 1 Jun 13 09:47 file user2 is under same group and when he... (14 Replies)
Discussion started by: ITHelper
14 Replies

9. UNIX for Dummies Questions & Answers

How to change the default permission of a file

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

10. UNIX for Advanced & Expert Users

Timestamp of File permission change

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
Login or Register to Ask a Question