Jump to content
xisto Community
Vyoma

How To Change User Of A File Or Directory? Is it possible for admin?

Recommended Posts

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?

Share this post


Link to post
Share on other sites

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.RegardsYordan

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
Replying to tininhoI know this is old, but I just have to say - NEVER use 777 on your files. All this does is allow ANYONE access to all of your files (that's why it lets you in, because you're a random anyone, due to file ownership being messed up).Everyone with an internet connection can steal, destroy, change, spam etc your website when you do that. Everyone has direct access to every file on your server without as much as a password.The best thing to do in this situation is to contact the server operators via support ticket, and get them to fix your file "ownership". Ownership and Permissions aren't the same setting.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.