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 have a headless Ubuntu 12.10 server. I'm logged in as administrator via SSH. I cannot create a directory in my home directory:

administrator@Leo:~$ cd ~
administrator@Leo:~$ mkdir Test
mkdir: cannot create directory `Test': Permission denied

The equivalent as root does work:

administrator@Leo:~$ sudo mkdir Test

administrator@Leo:~$ ls -al
total 12
dr-x------ 3 administrator administrator 4096 Jul 14 21:14 .
drwxr-xr-x 6 root          root          4096 Oct 26  2011 ..
lrwxrwxrwx 1 administrator administrator   56 Sep 11  2011 Access-Your-Private-Data.desktop -> /usr/share/ecryptfs-utils/ecryptfs-mount-private.desktop
lrwxrwxrwx 1 administrator administrator   39 Sep 11  2011 .ecryptfs -> /home/.ecryptfs/administrator/.ecryptfs
lrwxrwxrwx 1 administrator administrator   38 Sep 11  2011 .Private -> /home/.ecryptfs/administrator/.Private
lrwxrwxrwx 1 administrator administrator   52 Sep 11  2011 README.txt -> /usr/share/ecryptfs-utils/ecryptfs-mount-private.txt
drwxr-xr-x 2 root          root          4096 Jul 14 21:14 Test

I am unsure where the ecryptfs-related stuff comes from. I don't believe I requested encryption of my home directory, but perhaps that is causing things to go awry? Can anyone explain what's gone wrong here and/or provide a solution?

share|improve this question
    
Is this 12.10 you are running or 12.04?? –  izx Jul 14 '12 at 20:25
    
It's 12.10 upgraded from 12.04. Actually, am wondering whether the upgrade had something to do with this... –  Kent Boogaart Jul 14 '12 at 21:23

3 Answers 3

up vote 3 down vote accepted

The current directory (your home) is missing the "w" (write) permission. Try these commands

cd ~
chmod u+w .

Don't forget the dot at the end. It represents the current directory.

Or you can do the same with just one command:

chmod u+w ~

You don't even need sudo according to my tests.

share|improve this answer
    
All useful answers, so hard to pick a winner. But this one was one of the first and I found the procedure the easiest. Thanks! –  Kent Boogaart Jul 14 '12 at 21:23

Looks like ownership on your home directory is messed up. At the very least, you should have write permission to your own home, and it looks like that is not the case. Here is the top few lines of output when I look at my own home directory:

mike@cobbler:~$ ls -al
total 474700
drwxr-xr-x 45 mike mike      4096 Jul 14 12:55 .
drwxr-xr-x  3 root root      4096 May 28 15:39 ..

Since it seems that root is able to do what it should, try the following:

sudo chmod 755 ~/

Note that this is not recursive, so it will only affect the home folder. After you've done this, try another ls -la and see what permissions on . are. If they seem to be changed, try mkdir again without using sudo or root, or simply 'touch afile'

Let me know how it goes!

share|improve this answer
1  
I think 700 (or u+w) would be less drastic. 755 is not wrong, but gives more permissions than required to solve the problem. –  marcus Jul 14 '12 at 20:32
    
I agree with you, marcus. From a sercurity standpoint, 700 would be better, but since this problem seemed fairly fresh, I wanted to suggest a return to default permissions on a home directory, and leave future changes to the owner's discretion. –  OpensourceFool Jul 14 '12 at 21:33
    

Try a

sudo chown administrator:administrator -R /home/administrator
sudo chmod u+w .
share|improve this answer
    
. refers to the current directory. You don't know what that directory will be (it depends on whatever commands have been issued before). Do you mean sudo chmod u+w ~administrator? –  Eliah Kagan Jul 15 '12 at 16:55

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.