Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> How To Change User Of A File Or Directory?, Is it possible for admin?
Vyoma
post Jan 11 2006, 11:55 AM
Post #1


Cosmic Overlord
Group Icon

Group: Members
Posts: 549
Joined: 26-November 05
From: Chennai, India
Member No.: 9,811



How to change user of a file or directory?
Is it possible for admin?

The problem at hand can be summarized something like this.
Say there is a directory and there are files in them:

dir1
+---file1
+---file2
dir2
+---file3
+---file4


dir1, file1, and file2 is owned by 'userx'.
dir2, file3, and file4 is owned by 'usery'.

Is it possible for 'userx' to change the ownership of dir2, file3, file4 to his own?
OR
Is is possible for 'usery' to change the ownership of dir2, file3, file4 to 'userx'?
OR
Is is possible for admin to change the ownership of dir2, file3, file4 to 'userx'?

If there is any possibility, could you please give me those commands, and any links to the documentation?
Go to the top of the page
 
+Quote Post
yordan
post Jan 11 2006, 02:48 PM
Post #2


Way Out Of Control - You need a life :)
Group Icon

Group: [MODERATOR]
Posts: 1,919
Joined: 16-August 05
Member No.: 7,896




chown -R oracle dir2 # will make oracle the new owner for "dir2" and recursively all the files and directories and subdirectories and files in subdirectories.
just type "man chmod" if you want to have more info.
If you want your files belonging both to the oracle user and to the dba group, you type :
chown -R oracle.dba dir2 # -R means recursively, oracle.dba means "user oracle and group dba".
justy type "ls -lR dir2 " in order to see that everything is like you want.
Be careful, if you are not root, this will be a suicide : the files will belong to oracle, and not any more to you, so you will not be able to modify or delete them.
Tell us if you need more help.
Regards
Yordan
Go to the top of the page
 
+Quote Post
vujsa
post Jan 11 2006, 11:58 PM
Post #3


Absolute Newbie
Group Icon

Group: Admin
Posts: 873
Joined: 20-February 05
From: Indianapolis, Indiana, USA (Midwest)
Member No.: 2,714



I assume we are talking about the user 0 issue where when a file or directory is created with a script, the server is the owner of the entity. Basically, the script told the server to create the entity.

The real problem is that in order to changed the permissions or ownership of a file, you have to be the owner. Even if the file already has the permission of 777, you cannot change the owner. Since we can't log in as the server, we need to write or use a script that will instruct the server to change the file attributes.

I use the Bharat's (Gallery) Cleanup Script to change the files to 777 so I can modify or delete them. This way, you can create a copy of the file which will be owned by you then delete the original. I've had a lot of trouble and no success in attempting to actually change the file's ownership.

If anyone fids a better way to deal with files that are owned the the server (user 0) let me know.

vujsa
Go to the top of the page
 
+Quote Post
Vyoma
post Jan 12 2006, 06:53 AM
Post #4


Cosmic Overlord
Group Icon

Group: Members
Posts: 549
Joined: 26-November 05
From: Chennai, India
Member No.: 9,811



vujsa, it was not a problem where the server created the file and directory, but I understand that problem too. I had to use scripts to change the files that were created by files. A very tedious process, and I would be glad to know if there were any other methods to do the same.

yordan, thanks. What you said worked. Thank you very much.

Moderators, you may close this topic.
Go to the top of the page
 
+Quote Post
yordan
post Jan 12 2006, 09:53 AM
Post #5


Way Out Of Control - You need a life :)
Group Icon

Group: [MODERATOR]
Posts: 1,919
Joined: 16-August 05
Member No.: 7,896



QUOTE
yordan, thanks. What you said worked.

You're welcome, Vyoma. Glad to have been helpful.
Yordan smile.gif
Go to the top of the page
 
+Quote Post
tininho
post May 3 2007, 05:58 PM
Post #6


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 4
Joined: 3-May 07
Member No.: 21,778



If you use Joomla, the most convenient way is to go to site - global configuration - server and from there change the directory and file permissions to 0777. Hope this helps.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. How To Change Ur Ip Address(43)
  2. Howto: Change Graphical Login To Text(3)
  3. Shut Down, Restart, Log Off XP Using A Batch File(23)
  4. How To Save A Image In Pdf File And Download It?(10)
  5. Recover Tables From A MySQL .frm File(6)
  6. Text File Operations VB.NET(5)
  7. Change Font On Series 60 Phone(9)
  8. Change Fonts On A S60 Phone [tutorial](13)
  9. Switch Network Settings With Batch Files(18)
  10. What Is Mkv? Need Help With This File Format?(6)
  11. Uploading Image File Through JSP Code To Server(8)
  12. Get User Input From Vbscript For Batch Files(2)
  13. Dynamically Change The Background Image On Mouse Effects!(3)
  14. Need To Hack An Admin Account On Xp... No Problem!(60)
  15. Bypassing Filtered Sites(29)
  1. Deleting A Corrupt File(24)
  2. Need Help Urgently (missing Or Corrupt Hal.dll File).(6)
  3. Messed Up My Boot.ini File With Vista...(13)
  4. How To Change Your Ip Address.(64)
  5. Graphcal User Interfaces In Java(4)
  6. Problem With Move_uploaded_file()(5)
  7. Safari And Hosts File(8)
  8. How To Copy File & Folders From Linux To Windows?.(10)
  9. Linux Basic Command - For Storing Compilation Error To File(1)
  10. Power Distribution Change Reboot After 8pm Pst On Saturday May 31, 2008(0)
  11. Need To Edit A Wav File [solved](1)
  12. Re-ordering Welcome Screen & Moving Heavily Fragmented File(1)
  13. Mysql And User File_priv(0)


 



- Lo-Fi Version Time is now: 24th July 2008 - 12:24 PM