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 am trying to copy a file from my Download directory to my Desktop directory; but I am getting the Permission Denied Error. Directory and file permissions doesn't restrict me from copying (Directory perm: 755 , file perm:- 664).

sockets@ankit:~$ ls -ld D
Desktop/   Documents/ Downloads/ 
sockets@ankit:~$ ls -ld Downloads/ Desktop/ 
drwxr-xr-x 9 sockets sockets 4096 Jan  4 12:52 Desktop/
drwxr-xr-x 3 sockets sockets 4096 Jan 10 16:24 Downloads/
sockets@ankit:~$ ls -l Downloads/Ankit.pdf 
-rw-rw-r-- 1 sockets sockets 96170 Jan 10 16:24 Downloads/Ankit.pdf
sockets@ankit:~$ cp Downloads/Ankit.pdf Desktop/Ankit.pdf
cp: cannot create regular file `Desktop/Ankit.pdf': Permission denied

Any ideas why I would be getting the permission error. I know I can use sudo to copy the file.

----------EDIT -1

sockets@ankit:/var/log$ df -i
Filesystem       Inodes  IUsed    IFree IUse% Mounted on
/dev/sda1       2501856 228878  2272978   10% /
udev             755379    510   754869    1% /dev
tmpfs            757578    431   757147    1% /run
none             757578      3   757575    1% /run/lock
none             757578      8   757570    1% /run/shm
/dev/sda6      27639808  37521 27602287    1% /home/mount

----------EDIT 2

sockets@ankit:~$ df -h | grep /dev/sd
/dev/sda1        38G  8.5G   28G  24% /
/dev/sda6       416G   87G  308G  22% /home/mount
/dev/sdc1        16G  2.1G   14G  14% /media/New Volume
sockets@ankit:~$ mount | grep /dev/sd
/dev/sda1 on / type ext4 (rw,errors=remount-ro)
/dev/sda6 on /home/mount type ext4 (rw)
/dev/sdc1 on /media/New Volume type vfat (rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks)
share|improve this question
    
please run the command "df -i" and paste the output as an edit to your question. –  fabricator4 Jan 10 '13 at 11:14
    
i have pasted the output of df -i –  Ankit Jan 10 '13 at 11:25
    
OK, not it then. If you run out of inodes it can cause a 'permission denied' error. This isn't the problem apparently. –  fabricator4 Jan 10 '13 at 11:30
    
If you were root, you would be able to copy those files. But Since you are a normal user, you can only read contents of Desktop and execute files there. That's all. You don't have a write permission. Does sudo cp Downloads/Ankit.pdf Desktop/Ankit.pdf work? –  Melon Jan 10 '13 at 11:34
1  
Ah yes, looked at wrong permissions. Sorry for confusion. –  Melon Jan 10 '13 at 16:45

2 Answers 2

up vote 3 down vote accepted

Here's another scenario that would cause the problem

chris@chris-desktop:~$ sudo cp Downloads/Ankit.pdf Desktop/Ankit.pdf
[sudo] password for chris: 
chris@chris-desktop:~$ ls -l Desktop/Ankit.pdf 
-rw-r--r-- 1 root root 19769 Jan 11 05:52 Desktop/Ankit.pdf
chris@chris-desktop:~$ cp Downloads/Ankit.pdf Desktop/Ankit.pdf
cp: cannot create regular file `Desktop/Ankit.pdf': Permission denied

In this case I already created a file in the destination directory with sudo so that it was owned by root. The file can not be overwritten by a normal cp command as user and results in a 'Permiision denied' error.

share|improve this answer
    
+1. I wasn't aware of this scenario. –  Ankit Jan 11 '13 at 6:15

OK, strange that it worked OK after creating a file with touch. I'm wondering if there's file system error of some sort in which case I'd strongly advise that you force an fsck check of the filesystem - Easily done. Save all open files and in a terminal window:

sudo touch /forcefsck
sudo reboot

After the machine comes back up it will test the root partition and then boot into Ubuntu normally. It may prompt you for permission to repair the file system or tell you what problems if any have been fixed.

share|improve this answer

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.