4

I'm a user on a public Linux server. We have a public shared folder which all users can use. I want to create a folder that I only want a few users to access. This can be done in the following ways:

  1. Create a group of users you want to provide access and then change the folder permission to that group. I can't do this because I don't have root privileges. Even if I ask the admin to create a group for me, I'll have to occasionally add/remove users from the group. This is not feasible
  2. Encrypt and zip the folder using "zip re" command. This will zip the folder and every time a user needs to access the contents, he needs to unzip. This becomes infeasible when my folder grow up to be large.
  3. creating and mounting an encrypted directory with encfs. Here you have to maintain two folders - an encrypted folder and a mount point folder. Every time you need to access a file/folder, you need to mount it to the mount point. This again requires a lot of copying a moving and is inefficient.

What I'm looking for is a simple process: enter the password and you can view the contents of the folder; enter the wrong password and access is denied. All I have to do is to share this password with other users. Is there anything in Linux that does this?

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
Buggy
  • 41
  • 3
  • 1
    Are you open to writing scripts or other programs, or are you looking to use only existing built-ins? By "view the contents of the folder", do you mean only being able to get a directory listing or changing the working directory to there? Do you want them to be prompted for the password on every access, or to "unlock" access to the directory for a certain amount of time? – spuck Oct 07 '20 at 15:02
  • Are you looking to create a durable directory -- one that will be there after you log off or reboot the computer? Or are you primarily concerned with access? If the latter, is this system set up to allow you to mount a network drive? Or maybe one of the many Internet data storage options is your best solution. – llywrch Oct 07 '20 at 15:32
  • @spuck Yes, I'm open to writing scripts. By "viewing" i meant you can do anything- read write execute delete. I have no time based restrictions. The user must be prompted for password everytime he/she tries to CD into it. Thanks – Buggy Oct 07 '20 at 17:44
  • How about making a new user to own that directory and setting it as the new user’s home directory, then requiring users to switch users (via su) to access it? – spuck Oct 08 '20 at 01:14

1 Answers1

3

Of all the methods mentioned, the best way is to create a group and provide read/write access to the group. And then add or remove from the group.

TheLastCoder
  • 131
  • 2