Manage default home directory permissions with adduser vs. useradd

Preston Hagar prestonh at gmail.com
Mon Jun 16 18:18:10 UTC 2014


You could just stick with adduser:

# adduser --shell /bin/false --gid <GID_OF_users> --gecos 'Fantasio'
fantasio

As another alternative, edit  /etc/login.defs   which is the config file
for useradd

and set

UMASK 027

which should give you 0750 permissions on the users home directory when you
create it with the useradd command.








On Mon, Jun 16, 2014 at 8:40 AM, Niki Kovacs <info at microlinux.fr> wrote:

> Hi,
>
> I want to set home directory permissions for newly created users to 0750.
> Instead of having to manually chmod 0750, I found out I could edit this
> behaviour in /etc/adduser.conf:
>
> DIR_MODE=0750
>
> Now here's a more tricky question. I have to create a series of users
> without shell access. What I'd usually do is something like this:
>
> # useradd -m -g users -s /bin/false -c "Fantasio" fantasio
> # useradd -m -g users -s /bin/false -c "Gaston Lagaffe" glagaffe
> # useradd -m -g users -s /bin/false -c "Gaston Lagaffe" glagaffe2
> # useradd -m -g users -s /bin/false -c "Jeanne Dupont" jdupont
> # useradd -m -g users -s /bin/false -c "Bertrand Labévue" blabevue
>
> Unfortunately my DIR_MODE=0750 directive is not operative, and these
> users' home directories get created with default 0755 permissions.
>
> Any idea if there's a secret trick or switch so they're directly created
> with 0750 permissions?
>
> Cheers,
>
> Niki
>
> --
> Microlinux - Solutions informatiques 100% Linux et logiciels libres
> 7, place de l'église - 30730 Montpezat
> Web  : http://www.microlinux.fr
> Mail : info at microlinux.fr
> Tél. : 04 66 63 10 32
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/
> mailman/listinfo/ubuntu-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20140616/162324cf/attachment.html>


More information about the ubuntu-users mailing list