top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Manage default home directory permissions with adduser vs. useradd

+1 vote
369 views

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 behavior 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 "abc" abc
# useradd -m -g users -s /bin/false -c "xyz" xyz

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?

posted Jun 16, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

You could just stick with adduser:

# adduser --shell /bin/false --gid  --gecos abc abc

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.

answer Jun 16, 2014 by Ramakrishnan
Similar Questions
+1 vote

I would like to manually add a new user to my Ubuntu 12.04 box with admin privileges.

This is what I did so far:

adduser 
adduser  admin, sudo

Edited the sudoers file with visudoers:

# User alias specification
...
User_Alias ADMINS = 
 ...
# User privilege specification

...
 ALL=(ALL) ALL 
...

I then logged in with the new user, but every time I try to run a command (like visudoers) it says the command is not found. when I "echo $PATH" the /bin/sbin directory is not in the path.

Is there a similar command to adduser but for admin users (so it copies the root user skeleton at the end (copy /etc/skel)? How do I manually create a user like the one I create as the first user when installing Ubuntu?

...