rsa – How do I take advantage of a specfic user’s attributes to generate an encryption key pair on the fly to encrypt a file?

Suppose I have the following 3 files with content:


This is file1.txt.  It is labeled red. 


This is file2.txt.  It is labeled green. 


This is file3.txt.  It is labeled blue. 

Suppose these 3 files are stored on my linux file system at:


Finally, suppose I have 3 users who can login to this linux machine:

user1 (should only see files labeled red)
user2 (should only see files labeled green)
user3 (should only see files labeled blue)

How can I use the RSA encryption scheme to generate unique private keys for user1, user2, and user3 such that they can see the files they can decrypt the files they are supposed to see but not the ones they should not see?

Put another way, how can I generate a key pair (public/private) so that user1 can can encrypt red-labeled files and users 2 and 3 cannot decrypt file1.txt?