This happens to me all the time, usually when I copy a text file generated on Windows over to my Linux server via a network share managed by samba
on the server's side. Hastur is right, in the comments, and Joe Sewell in his answer, too: it's just the 'executable' permissions flag is set. My solution is:
chmod u-x,go+r filename
This makes it not-executable for my user, and readable for 'group' and for 'others'. The ,go+r
part is optional, as long as you are the only one who's going to need to access the file.
EDIT: It should be possible to change the default samba
behavior for these permissions. I haven't bothered to try figuring it out, but a quick Google search turned up this serverfault post that describes the first thing I would try:
I typically use SAMBA's native functionality for permissions and groups management on shares. For example..
force user=user1
force group=sharedgroup
create mask=775
You would specify these settings under the share. Be certain to reload SAMBA after the configuration change, which could be done via the init script.
Based on the comments on that question/answer, there are a number of subtle and specific settings that must be properly set. I'm able to be of no help in that regard, I'm afraid.
2What's the originating OS? What's "file yourfile" indicate? This should help identify line endings, encoding, or that your simple text file is actually binary on the host OS. – ǝɲǝɲbρɯͽ – 2015-04-23T16:10:25.443
1I think you see different attributes: the executable one
x
, probably-rwxrw-r--
. Try withls -l yourfile
. If you want to see if it is binary check withtype yourfile
. Of course if so it depends on how you mounted the shared partition on the guest system. – Hastur – 2015-04-23T16:12:17.833@Hastur Of course, executable makes more sense! – ǝɲǝɲbρɯͽ – 2015-04-23T16:15:38.680