Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

i am sudo user and i copied files from one user account to another user's account and i gave permissions like

              sudo chmod 777 ..../*.*

but it is giving like

        -rwxrwxrwx 1 root root    7168 2011-04-26 10:44 test.db
        -rwxrwxrwx 1 root root 3826370 2011-04-26 10:44 libport.a

but when other user who has copied files,cant remove those files by giving

        rm test.db
        rm libport.a

so what should i do without installing any softwares?

Thanks in advance

share|improve this question

migrated from stackoverflow.com Apr 26 '11 at 8:17

This question came from our site for professional and enthusiast programmers.

    
try chgrp <your user> <which ever file> –  ArunMu Apr 26 '11 at 5:52
1  
you need write permissions on a directory to remove files from it. –  Dan D. Apr 26 '11 at 5:52
    
I explain all about Unix File Permissions in the SU Blog: blog.superuser.com/2011/04/22/linux-permissions-demystified –  Majenko Apr 26 '11 at 8:50

2 Answers 2

Creating and removing files in a directory requires write access to the directory, not the files themselves.

I should mention that, in the UNIX world, it is 777 which is the number of the beast rather than 666. Setting your permissions to 777 is almost always a bad idea.

In addition, setting the permissions on files currently in existence has zero effect of files which will be created in the future. The permissions given to files are (when unspecified) determined by your umask setting.

share|improve this answer
    
I agree 777 is bad - data files should not be executable! But the number of the beast is also bad; public write permission should normally be avoided (so 666 is not good; 664 or 644 is much better). –  Jonathan Leffler Apr 26 '11 at 6:21

To change ownership of files use:

sudo chown system_username / file_location

To change file permissions use:

sudo chmod 0777 (or the permissions you want) / file_location

Use the second command and apply it to the directory in which your copied files are placed. That will give file create & delete access inside that directory.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.