Linux Q: Folder permissions + Mounting

Discussion in 'OT Technology' started by AbortionSurvivor, Mar 21, 2005.

  1. AbortionSurvivor

    AbortionSurvivor Active Member

    Joined:
    Jun 5, 2002
    Messages:
    3,016
    Likes Received:
    0
    Location:
    Nor. Cal
    I mounted a shared Windows network directory here.
    /mnt/windows_share

    After this directory is mounted, it is available for all everyone on the Linux box to use and see.
    How do I only allow a specific user to access this directory?

    Do I change the permisions before the directory is mounted? Or after?
    How do I change the permissions?

    Thanks guys.
     
  2. Joe_Cool

    Joe_Cool Never trust a woman or a government. Moderator

    Joined:
    Jun 30, 2003
    Messages:
    299,329
    Likes Received:
    566
    man mount

    scroll down to the section on smb. that will give you all the options, including setting permissions at mount time.
     
  3. Joe_Cool

    Joe_Cool Never trust a woman or a government. Moderator

    Joined:
    Jun 30, 2003
    Messages:
    299,329
    Likes Received:
    566
    Relevant parts from man smbmount:

    So assuming you want the mount to be readable only by bob whose uid is 501 (it's in /etc/passwd), you would do something like this:

    mount -t smbfs username=remoteuser,password=remotepass,uid=501,fmask=700,dmask=700 //remoteserver/share /mountpoint

    Except in the options line, there should be no space. I hate that line-break feature sometimes. :mad: It's "fmask", not "fm ask"
     
    Last edited: Mar 22, 2005
  4. Penguin Man

    Penguin Man Protect Your Digital Liberties

    Joined:
    Apr 27, 2002
    Messages:
    21,696
    Likes Received:
    0
    Location:
    Edmonton, AB
    Rather than calling that big long command every time, you should be able to put those options in the /etc/fstab file and then when you call mount /mountpoint it'll use them by default.
     
  5. Joe_Cool

    Joe_Cool Never trust a woman or a government. Moderator

    Joined:
    Jun 30, 2003
    Messages:
    299,329
    Likes Received:
    566
    True. But he'll know that when he reads the manpage. :mamoru:
     
  6. TV-MA

    TV-MA Guest

    couldn't you also jsut chown the mnt/dir to one specific user for a fast workaround?
     

Share This Page