Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to create a new user and give him possibility to use git. So, I've installed git:

sudo apt-get install git

After that I've created a user:

sudo useradd -d /home/developer -s /bin/bash -g sudo -m developer

And now I have a problem. When I switch to a new user and try to do something like this:

git clone <<here is a path>>

I get this error message:

fatal: unable to access '/home/roman/.config/git/config': Permission denied

I can't get why environment variables points to another user folders and what is the good way to fix it. I also believe that I didn't specify something properly during creation of a new user (that is why environment variables have not proper values).

The same problem appears when I try for instance to run mc... I get this:

Cannot create /home/roman/.config/mc directory

For more information have this

cat /etc/passwd | grep developer


So, can somebody explain me how to solve my problems?

share|improve this question
The result of whoami is developer. And result of cat /etc/passwd | grep developer is developer:x:1001:27::/home/developer:/bin/bash. – Roman Dryndik Oct 27 '13 at 1:08
Ok, I've changed my question. – Roman Dryndik Oct 27 '13 at 1:16
how did you switch to a new user? you should log in as the new user. your problem is likely that you used sudo and the environmental variables were preserved – bodhi.zazen Oct 27 '13 at 4:05
How did I switch to another user? kh-kh... su developer. And yes I used sudo when ran useradd, because otherwise I will get useradd: cannot lock /etc/passwd; try again later. – Roman Dryndik Oct 27 '13 at 8:19
log out and log back in as developer, or use check the man pages for sudo and environmental variables such as $HOME – bodhi.zazen Oct 27 '13 at 15:14

When you use sudo and/or sudo to switch users, Environmental variables so not necessarily change. It depends on what command you use, options, and configuration.


 sudo -u children echo $HOME

Check the man pages for details and/or post your command for help.

Setting the PATH so it applies to all users, including root/sudo

share|improve this answer

Your Answer


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.