Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Different umask for different directories?

  • 06-11-2005 12:41AM
    #1
    Registered Users, Registered Users 2 Posts: 1,865 ✭✭✭


    Is it possible to set a different umask for different directories?

    I would like the files in ~/public_html to have u=rw,g=,o=r umask, but the files in ~/backup to have u=rwx,g=,o= umask.

    The only possible solution I've seen is: http://www.unix.org.ua/orelly/unix/upt/ch14_14.htm, which involves aliasing cd to a script that can check the directory and set the appropriate umask.

    Is there a better way?


Comments

  • Registered Users, Registered Users 2 Posts: 37,485 ✭✭✭✭Khannie


    If it makes any difference, I would have suggested the aliasing thing too. Seems the most logical way to me. Certainly couldn't think of an "out of the box" solution....though I'm no unix expert.


  • Registered Users, Registered Users 2 Posts: 3,744 ✭✭✭deRanged


    why not just chmod them after they're copied to the backup dir?
    it'd only be one extra line in the backup script.


  • Registered Users, Registered Users 2 Posts: 1,865 ✭✭✭Syth


    deRanged wrote:
    why not just chmod them after they're copied to the backup dir?
    it'd only be one extra line in the backup script.
    I don't have a backup script, I use Unison (a great little programme BTW), plus there would be a window in which things are available. I don't have sensitive stuff there, but I'd like it to be secure.

    If there is no solution, I'll just keep a umask of u=rw,g=,o= and ease up the permissions manually on my webdir.


  • Registered Users, Registered Users 2 Posts: 3,744 ✭✭✭deRanged


    I'm pretty sure I don't get this at all. :)

    You're keeping a backup of your web dir, manually with Unison?
    You could wrap the call so that your umask is temporarily changed.
    Syth wrote:
    I don't have a backup script, I use Unison (a great little programme BTW), plus there would be a window in which things are available. I don't have sensitive stuff there, but I'd like it to be secure.
    it's a backup of your web directory isn't it?


  • Registered Users, Registered Users 2 Posts: 1,865 ✭✭✭Syth


    No. I'm using UCD's internet society (netsoc), which members a shell account and webspace. We get 2GB each. I have my website there and I use it for backup. I mirror the stuff on my local harddrive to netsoc. My website stays and netsoc.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 1,186 ✭✭✭davej


    What version of unix are you running ? With Solaris, for example, you could use ACLs to do this (setting the "default" for user, group, other).

    man setfacl

    edit: This still requires a manual change for the directory, but does give you more fine grained control..

    davej


  • Registered Users, Registered Users 2 Posts: 1,865 ✭✭✭Syth


    davej wrote:
    What version of unix are you running ? With Solaris, for example, you could use ACLs to do this (setting the "default" for user, group, other).

    man setfacl

    edit: This still requires a manual change for the directory, but does give you more fine grained control..

    davej
    OpenBSD 3.6

    setfacl doesn't seem to be a command or in the man page.


Advertisement