Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I noticed that some files downloaded from the internet have executing permission (e.g. Tor, Bit-torrent, Sync etc.) by default.
Therefore the permission information is stored within the files itself, but not on the computer.

Does that mean, that there's a possibility for hackers to create viruses and set execute permission?
If that's so, hackers could trick the user to execute the virus.
From this point of view, security on Linux is not better than Windows.

Can someone explain this clearly to me?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

No. Whenever you create a new file the umask is applied. This umask is a number that dictates what permissions will the file have.

For having execution permission masks should be either 7, 5 or 3. No file is created with those masks. But, beware of compressed files, since those keeps their file permission when you extract them. If you keep downloading things from trusted sources and verify the content before doing anything, you should be alright.

Let's see how umask works:

For files the default mask is 0666 and the umask is 0022. The system each time you create a file do this operation:

mask - umask = file permissions
0666 - 0022  = 0644

The permissions numbers broken down is like follows:

0644
^^^^
||||
|||\_ others permissions, in this case only read
|| \__ groups permissions, in this case only read
| \___ user permissions, in this case read and write
 \__ special byte

Hence, each file created by your user is created so you can read and write the file, your group can read them, and others can read them too. Nothing to do with the executables.

share|improve this answer
    
I understand now. Tor and BittorentSync are compressed so their permission is kept. Thanks. –  Tri Quoc Nguyen Sep 16 '13 at 2:52
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.