Results 1 to 6 of 6

Thread: How to make certain files/folders invisible to specific users?

  1. #1
    Join Date
    Jun 2007
    Location
    SF Bay Area, CA
    Beans
    27
    Distro
    Ubuntu 10.10 Maverick Meerkat

    How to make certain files/folders invisible to specific users?

    I've got a NAS running and I'd like to somehow make some of the folders and files invisible to certain users only. For example, if I 'ls' a directory, I want to see files 'a', 'b', and 'c'. But if another user does 'ls' in the same directory, I only want them to be able to see 'a' listed.

    I know I can use 'chmod +700' to make certain files not able to be read/written, but the filename would still appear in a 'ls'.

    I know I can put certain files inside of a '.hidden' file in the folder, but then it would be hidden from myself as well.

    Is what I'm trying to do possible?

    Edit : I'd also like to mention that the users that connect to the NAS could be coming from Windows or Mac operating systems. So hopefully the solution would work for users from those systems also..
    Last edited by HimeNoHogosha; January 7th, 2011 at 09:49 AM. Reason: Adding more details

  2. #2
    Join Date
    Nov 2009
    Location
    East Anglia
    Beans
    415
    Distro
    Xubuntu

    Re: How to make certain files/folders invisible to specific users?

    Quote Originally Posted by HimeNoHogosha View Post
    I've got a NAS running and I'd like to somehow make some of the folders and files invisible to certain users only. For example, if I 'ls' a directory, I want to see files 'a', 'b', and 'c'. But if another user does 'ls' in the same directory, I only want them to be able to see 'a' listed.

    I know I can use 'chmod +700' to make certain files not able to be read/written, but the filename would still appear in a 'ls'.

    I know I can put certain files inside of a '.hidden' file in the folder, but then it would be hidden from myself as well.

    Is what I'm trying to do possible?

    Edit : I'd also like to mention that the users that connect to the NAS could be coming from Windows or Mac operating systems. So hopefully the solution would work for users from those systems also..
    I don't know of any direct way to do this with ls. A possible workaround might be to use the colors that ls produces for different file types to render them invisible. See the man pages for "dircolor" and "dir_colors" for how to do this. Basically you can add to the defaults, for example to make files with extension .xyz invisible you would add
    Code:
    *.xyz=37;47
    to the LS_COLORS shell variable and then ls would show a blank white/grey block for those files. A bit lame I'm afraid, but the "." at the beginning of the name is the Unix/Linux way to hide things normally. So if you add the export "LS_COLORS=..." to the users .bashrc you can make some files invisible(ish) to ls.

    H

  3. #3
    dino99's Avatar
    dino99 is offline Ubuntu addict and loving it
    Join Date
    Jun 2006
    Location
    Nux Jam
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: How to make certain files/folders invisible to specific users?

    To hide a file or folder in Nautilus, either rename the file so its name begins with the period (.) character, or create a text file named .hidden in the same folder, and add its name to it, as in the example below:

    filename
    foldername


    http://chetangole.com/blog/2008/11/h...-ubuntu-linux/

  4. #4
    Join Date
    Jun 2007
    Location
    SF Bay Area, CA
    Beans
    27
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: How to make certain files/folders invisible to specific users?

    Well I wouldn't want to add a '.' in front of all the files because they would then have a different filename, and also I don't want the files to be hidden to everybody. I also don't want to just play with the colors because that wouldn't work for people using Windows or Mac.

    The '.hidden' thing kind of works, but the problem is the user can still see the folder, and it's when they try to access it they are notified that they don't have permissions. But I'm trying to go one step before that and make the folder not even visible to them in the first place so they don't know it's there at all.

    I kind of wish that in addition to read/write/execute permissions, there was visibility permission...

  5. #5
    Join Date
    May 2008
    Location
    Berks, UK
    Beans
    1,387

    Re: How to make certain files/folders invisible to specific users?

    Correct me if I have the wrong impression, but the NAS is the key element here, as that is where the permissions will reside, under the control of whatever OS drives the NAS.

    It's a good chance that it will be a customised linux - but where do you go from there? The rules on your own PC won't be applied on the NAS.
    Derek

  6. #6
    Join Date
    Mar 2008
    Location
    Cloud 9
    Beans
    1,428
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: How to make certain files/folders invisible to specific users?

    You might try Gobohide, which will actually make folders invisible to everyone and can only be opened if you know the exact path/to/secret/folder-name... that only you will know.. so don't forget it.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •