LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-17-2010, 10:43 PM   #1
cbservices
LQ Newbie
 
Registered: Nov 2010
Posts: 3

Rep: Reputation: 0
Question Bizarre permissions problem?


First let me start off by saying I'm not a Linux noob. I've been using it since somewhere around 1997, including setting up servers, routers, and desktops. Up until now my Google-fu has been good enough to solve every problem I've run across with it.
But this one's got me stumped.

I've written a Perl script that, among other things, checks filetypes using the 'file' command, and compares them to the actual extension. This is a security related script, that's basically looking for hidden executables (.exe files that are named .tmp, and the like) so it can flag them as suspicious. It also does a few hash (SHA1, SHA256, MD5) calculations, so I can search for known system files that have unknown hashes, etc.

Well, I've run across this problem on two different machines, with two different versions of Windows (XP and 7), both NTFS filesystems, one running a custom OpenSuSE LiveCD, and the other running a default Knoppix 6.2.1 DVD. Both times it's been a particular pair of files to do with AVG antivirus that gave me problems. The first time, I thought maybe there was some filesystem corruption, and ignored it.

Basically what I've got is a file that I have read permissions for, according to 'ls', but I can't view the file. When the script gets to this file, trying to open it for the MD5 calculation, it dies, because it's not able to read the file, and I never put any error checking in for that, since I figured all files should be readable, without exception.

From the command line, I get this:

Code:
root@Microknoppix:/media/sda3/ProgramData/AVG10/Chjw# ls
3ee6c744e6c6fb63  3ee6c744e6c6fb63.dat  6212c4f212c4cbeb  6212c4f212c4cbeb.dat
root@Microknoppix:/media/sda3/ProgramData/AVG10/Chjw# ls -l
total 9
drwxrwxrwx 1 knoppix knoppix 4096 Nov 18  2010 3ee6c744e6c6fb63
-rwxrwxrwx 2 knoppix knoppix  172 Nov 14 15:47 3ee6c744e6c6fb63.dat
drwxrwxrwx 1 knoppix knoppix 4096 Nov 18  2010 6212c4f212c4cbeb
-rwxrwxrwx 2 knoppix knoppix  130 Nov 16 20:44 6212c4f212c4cbeb.dat
root@Microknoppix:/media/sda3/ProgramData/AVG10/Chjw# file *
3ee6c744e6c6fb63:     directory
3ee6c744e6c6fb63.dat: executable, regular file, no read permission
6212c4f212c4cbeb:     directory
6212c4f212c4cbeb.dat: executable, regular file, no read permission
root@Microknoppix:/media/sda3/ProgramData/AVG10/Chjw# less 3ee6c744e6c6fb63.dat
3ee6c744e6c6fb63.dat: Input/output error
root@Microknoppix:/media/sda3/ProgramData/AVG10/Chjw# whoami
root
root@Microknoppix:/media/sda3/ProgramData/AVG10/Chjw#
You can see that the 'file' command returns that I have no read permission to the dat files, but according to 'ls', I do. I'm also running as root at this point, so I should be able to read everything.

Both machines have returned the I/O error, rather than a permissions error when trying to open the file manually.

It's not a failing hard drive, and from what I can tell, it's not a corrupt filesystem, either. But the fact that it was these same two dat files the first time I ran across this, leads me to think it couldn't be anything breaking, as the chances of it being the same two files in both cases are virtually nil. It's got to be something peculiar about the way AVG saves these files, but I can't imagine what it could be.

Anybody have the slightest clue what's going on here?

Thanks,
Chris
 
Old 11-17-2010, 11:02 PM   #2
santosh_p82
LQ Newbie
 
Registered: Nov 2010
Posts: 3

Rep: Reputation: 0
Is it a tape media? If so clean the tape drive and reinsert..or check if the version suits linux
 
Old 11-17-2010, 11:15 PM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Maybe that is one of the special options of NTFS that Linux is currently not able to handle? I don't have a clue what option it may be, can it be marked as system file or something similar?
 
Old 11-17-2010, 11:56 PM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
For the NTFS filesystem, when mounting on Linux, the permissions of all files and directories are determined by the mount command.
So you won't have the permissions of some files differ from others.

Also, a feature of NTFS is that small files may be contained in the directory, instead of located on the filesystem itself.
This makes me wonder if either the NTFS filesystem is corrupt, or the version of ntfs-3g your version of knoppix uses, doesn't fully support the version of the NTFS file system you are looking at.

Also, read the manpage for ntfs-3g. I'm wondering if the problem may involve Alternate Data Streams. Whether you have access to them, and how you can, depends on how the filesystem was mounted. Another reason for reading up on them, and user_xattrs, is that this feature of NTFS was created to support Mac clients. It was discovered that malware writers were using it to hide code from scanners. Mounting and scanning a Windows filesystem from Linux, make sure that files written as alternate data streams of other files are detected as well.

Could there be an issue with a forbidden character '/,\,\0' being used in the file name? One way to manipulate a file with strange names, or identical names is to list the inode of the file, and access the file using the file command:
Code:
 ls -i
3277557 New Document.ott     3276902 opensuse112.zip    3277273 opensuse113.zip
3277556 New Spreadsheet.ots  3278052 opensuse11.3_docs  3278785 Новий Файл
> find . -inum 3278785 -exec stat '{}' \;
  File: `./Новий Файл'
  Size: 6943      	Blocks: 16         IO Block: 4096   regular file
Device: 803h/2051d	Inode: 3278785     Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/jschiwal)   Gid: ( 1000/jschiwal)
Access: 2010-11-17 23:53:48.621999935 -0600
Modify: 2010-11-17 23:53:48.621999935 -0600
Change: 2010-11-17 23:53:48.621999935 -0600

Last edited by jschiwal; 11-17-2010 at 11:57 PM.
 
Old 11-18-2010, 12:02 AM   #5
cbservices
LQ Newbie
 
Registered: Nov 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by santosh_p82 View Post
Is it a tape media? If so clean the tape drive and reinsert..or check if the version suits linux
Not a tape drive. Otherwise I probably wouldn't have mentioned that it's not a failing hard drive, would I?

No, this is an offline scanner script to do some diagnostics on virus infected machines. So it's only ever run against hard drives in Windows machines.

Quote:
Originally Posted by TobiSGD View Post
Maybe that is one of the special options of NTFS that Linux is currently not able to handle? I don't have a clue what option it may be, can it be marked as system file or something similar?
That's a possibility, I suppose. I've just never run across it before, and I've been using Linux live CDs of various types for years to fix broken Windows machines.

It does seem weird that AVG would mark a file like this, but not a single Windows file is marked with this option, though, doesn't it?





I forgot to mention, also, that the kernel versions on these two machines when I've run across this were different, too. Both 2.6 series, but a few build revisions apart.

So, a couple of decent suggestions, but nothing useful so far for this particular situation. Any kernel and/or other Linux gurus want to take a stab at this?

Chris
 
Old 11-18-2010, 12:14 AM   #6
cbservices
LQ Newbie
 
Registered: Nov 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jschiwal View Post
For the NTFS filesystem, when mounting on Linux, the permissions of all files and directories are determined by the mount command.
So you won't have the permissions of some files differ from others.
I knew that. Which is why this seems so bizarre to me.

Quote:
Originally Posted by jschiwal View Post
Also, a feature of NTFS is that small files may be contained in the directory, instead of located on the filesystem itself.
Also knew that. Haven't had a problem accessing any other small files before, though, so I don't see what would be different about this.

Quote:
Originally Posted by jschiwal View Post
This makes me wonder if either the NTFS filesystem is corrupt, or the version of ntfs-3g your version of knoppix uses, doesn't fully support the version of the NTFS file system you are looking at.
I thought of filesystem corruption, but due to it being the exact same two files, on two different machines, running two different versions of Windows, and two different live CDs, with two different distributions, leads me to believe that the chances of this being a filesystem corruption problem are essentially zero. The NTFS version idea is also a pretty slim chance. Now the ntfs-3g might not support it, as the two CDs probably have very similar versions on them. I'll have to look that up.

Quote:
Originally Posted by jschiwal View Post
Also, read the manpage for ntfs-3g. I'm wondering if the problem may involve Alternate Data Streams. Whether you have access to them, and how you can, depends on how the filesystem was mounted. Another reason for reading up on them, and user_xattrs, is that this feature of NTFS was created to support Mac clients. It was discovered that malware writers were using it to hide code from scanners. Mounting and scanning a Windows filesystem from Linux, make sure that files written as alternate data streams of other files are detected as well.
Now that's something that's worth looking at. I'll take a look in the morning, as it's 1 AM here now, and I really should be getting some sleep.



Quote:
Originally Posted by jschiwal View Post
Could there be an issue with a forbidden character '/,\,\0' being used in the file name?
Look at my first post for the directory listing. No forbidden characters. Not even any special characters. Just alphanumeric for these two files.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bizarre Anacron permissions error rollo Linux - General 4 11-13-2006 11:44 AM
Bizarre routing problem Doug Melvin Linux - Networking 1 10-28-2004 12:04 PM
Bizarre XF86Config problem... Shade Linux - Software 3 07-07-2003 01:19 AM
Bizarre CD problem masterJ Slackware 9 07-02-2003 08:31 AM
a Bizarre problem seemed to be..... yunxiang Linux - General 2 02-06-2003 04:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration