Re: can i modify ls
From: Markus Klotzbuecher
Date: Wed Feb 25 2004 - 09:58:49 EST
On Friday 27 February 2004 22:03, Gautam Pagedar wrote:
> working on a project to tweak the working of 'ls' command depending on my
> requirement. I have observed that 'ls' show ALL THE FILES and DIRECTORIES
> in a particular location even though a user has no access rights to it. I
> want to hide all
> such files for that particular user.
>
> The Algorithm i beleive should work like this when an 'ls' command is
> called.
>
> 1. Check the current directory.
> 2. Extract the files or directory to be displayed.
> 3. Check the user permissions for these files.
> 4. Display only those files wher user had either read, write or execute
> access for all owner,group and others.
>
> I have found out that 'ls' uses getdents64() system call for gathering the
> directory information. How do i move ahead from here.
You could do it in the kernel, by using a stackable filesystem and tweaking
the readdir file operation to do what you want. Then you can mount it on top
of the root filesystem, and all accesses will pass through it, where you hold
back the files a user shouldn't see.
On www.filesystems.org you can find bare stackable filesystem templates by
Erez Zadoc, but maybe you could even use the high level Fist language to
generate such a filesystem.
Just an idea...
Cheers
Markus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/