Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Default permissions for file creation

  1. #1
    Join Date
    Feb 2009
    Location
    Madison, WI
    Beans
    173
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Default permissions for file creation

    I am running Ubuntu 20.04. When I create a new file, say with LibreOffice Calc, the permissions of that file are
    Code:
    -rw-rw-r--
    What can I do so that the file is automatically created with the permissions being
    Code:
    -rw-------

  2. #2
    Join Date
    Dec 2014
    Beans
    2,566

    Re: Default permissions for file creation

    The search term to find what you're looking for is 'umask'.

    Holger

  3. #3
    Join Date
    Feb 2009
    Location
    Madison, WI
    Beans
    173
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: Default permissions for file creation

    Thank you. Where should this be set? I already set it to 077 in
    .bashrc
    .gnomerc
    .profile
    but this does not affect the behavior of LibreOffice when creating files.

  4. #4
    Join Date
    Feb 2009
    Location
    Madison, WI
    Beans
    173
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: Default permissions for file creation

    I am still wondering about this in standard Ubuntu. It's still an issue in 21.04. Specifically, in which file should the desired umask 077 be set so that all new files created will have permissions set to
    Code:
    -rw-------
    As I mentioned before, setting the umask in
    .bashrc
    .gnomerc
    .profile
    does not work even after logging out and logging back in.

  5. #5
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: Default permissions for file creation

    I changed the umask in ~/.profile overriding the default 022 with 077. Then I ran
    Code:
    seiji@Linux:~$ source .profile
    seiji@Linux:~$ touch test
    seiji@Linux:~$ ls -l test
    -rw------- 1 seiji seiji 0 Apr 24 10:28 test
    Seems to work as advertised.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  6. #6
    Join Date
    Feb 2009
    Location
    Madison, WI
    Beans
    173
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: Default permissions for file creation

    I get the same result as SeijiSensei when I create a new file with touch.

    But if I create the file with gedit, I still get
    Code:
    -rw-rw-r--
    So my question still stands.

  7. #7
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Default permissions for file creation

    That's clearly a bug in gedit and has been for years. Open a bug with the Gnome guys for ignoring a proper umask set in the files which should be run at login, BEFORE any GUI session begins.

    https://ubuntuforums.org/showthread.php?t=2364921

  8. #8
    Join Date
    Dec 2009
    Beans
    6,767

    Re: Default permissions for file creation

    The bug is in Poettering ... erm ... systemd.

    If Nautilus and gedit is the issue do this - but note that it will not do jack for LibreOffice so it does not answer the original question. And don't forget to logoff and log back in again:

    https://askubuntu.com/questions/1322628/how-to-set-umask-to-u-rwx-g-rwx-o-rx-for-all-ways-of-logging-in-without-root-pri

    Last edited by Morbius1; June 6th, 2021 at 01:46 PM.

  9. #9
    Join Date
    Apr 2008
    Beans
    108

    Re: Default permissions for file creation

    See the link below for a discussion of this.

    For Ubuntu >= 20.04, you need to edit /etc/login.defs.

    You will need to edit two entries:

    UMASK 077

    USERGROUPS_ENAB no

    As noted in the file, if you do not change USERGROUPS_ENAB from the default "yes", then user permissions will be used as group permissions, eg 077 will become 007.

    However, again as noted in the file, changing USERGROUPS_ENAB has other consequences.

    You need to reboot for this to take effect

    This works for gedit and LibreOffice on 21.04 at least.

    https://askubuntu.com/questions/9294...n-ubuntu-17-04
    Last edited by philhughes; June 6th, 2021 at 03:25 PM.

  10. #10
    Join Date
    Feb 2009
    Location
    Madison, WI
    Beans
    173
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: Default permissions for file creation

    Thank you, philhughes. This worked for me. Thread marked as solved.

Page 1 of 2 12 LastLast

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
  •