Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

See I have made one executable file in my fedora -14 linux machine & set its permission is like

-rwxrwxr-x   1 jeegar jeegar     4809 Oct 18 12:40 a.out

But when I transfer this file by "G2ipMsg" (a one program for chating/sharing on local LAN connection) to another fedora 15 machine then its permission are going to changed

Why this happening?

What should I do, so that file's permission noone can change even if I sent or transfer to anywhere?

share|improve this question

migrated from stackoverflow.com Oct 18 '11 at 7:29

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

add comment

2 Answers 2

up vote 3 down vote accepted

Your transfer program "G2ipMsg" needs to know how to transfer permissions, and this is something that it might not be capable of, if the program only transfers the contents of the file, and not permissions and other metadata.

You may be able to work around this a bit by wrapping the file in something that supports the metadata you want. For permissions, a .tar file should be able to store it. (The other end will have to extract the .tar file.)

share|improve this answer
add comment

The receiver of this file is receiving the contents that your chat application is reading and passing over the network. The receiver is creating a new file with their own default permissions and the contents is being written into that new file.

If you want to transfer files and retain permissions you need to record those permissions along with the file. one way to do this is using 'tar', this will create an archive of the file you want and when you want to extract the file you can specify 'preserve permissions'.

create:

tar -cvf archive.tar file1 file2

extract:

tar -xpvf archive.tar
share|improve this answer
    
hey magic worked thanks –  Mr.32 Oct 18 '11 at 7:25
add comment

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.