What are the command(s) to create a new user (not from su), give him the ability to write to only one folder which is some directory owned by an already existing user (the one that created him)? Meaning that the folder is already under some existing user's FS. How can I create another user and only let him write to that folder?

I was told here:

Use useradd, adduser, or whatever utility your unix variant has to create a user. The easiest way to control access to the directory is to make it and its files (but nothing else) owned by a newly created group, and make the new user a member of that group (and no other group).

but I do not know which commands to use to do such thing. So how to do it?

  • These commands are somewhat distribution specific. What is your distribution? Commented Jun 16, 2011 at 16:08
  • CentOS and OpenSuse
    – Kabumbus
    Commented Jun 16, 2011 at 16:09
  • It would be helpful to know a little more about your use case. Specifically, do you not want the user to have a home directory, or do you perhaps want him to have a home directory that is owned by someone else? I'm not sure if that is possible. Commented Jun 16, 2011 at 17:30
  • I do not want the user to have a home directory.
    – Kabumbus
    Commented Jun 16, 2011 at 21:35

2 Answers 2


So you want to

  1. create a group;
  2. create a user in that group, without giving that user a home directory to write in;
  3. make a certain directory owned by that group and writable by it.

The following commands should do the trick on any Linux distribution.

groupadd --system myappgroup
useradd -c 'system user for myapp' -d /none -g myappgroup \
        -M -N -r -s /bin/false myappuser
chgrp myappgroup /path/to/directory
chmod g+rwxs /path/to/directory

Simple answer, you can't. The system doesn't know who created a user and by default only root has that privilege. A regular user can not create a user without su or sudo. At least that's how I understand it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .