Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to create a new user to run a service on the system but don't want to have /home and other configuration files for it. Like there is a user for postgres but it doesn't have any /home directory.

share|improve this question
    
I just found this howtogeek.com/howto/ubuntu/add-a-user-on-ubuntu-server –  Owais Lone Mar 7 '11 at 10:02
add comment

3 Answers

up vote 27 down vote accepted

By default the command useradd doesn't create home directorys, but for a daemon I recommend you also use the system option and change the shell to a non-existent one so no one can login with said account (in ssh for example):

sudo useradd -r -s /bin/false USERNAME

You can see all the options with man useradd and man groupadd if you want to create a group for the user too.

share|improve this answer
2  
useradd -r creates a system user, not only a user with no homedir. –  fromnaboo Aug 12 '12 at 15:23
    
notice, useradd -r also creates corresponding groups. –  Sandro Dzneladze Mar 31 at 11:00
add comment

Try adduser --system --no-create-home USERNAME or simply have a look at the manpage of adduser which claims to be a "friendlier front end to the low level tools like useradd...".

share|improve this answer
add comment

try this command:

sudo useradd vivek

This will create a user without creating your home folder at /home/vivek

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.