Linux – cannot create directory. permission denied. but i have permission

chmodlinuxpermissionsUbuntu

i'm fairly new to linux, and ran ubuntu the other day.
it is running dual boot with windwos 8.
now, the problem is, even though i log in as root and give a specific folder ALL PERMISSIONS (#chmod 777 filename), it still doesn't let me create a directory or save an edited file, saying (cannot create directory: no such file or directory). it gave me the same error even as i logged in as root GUI. since then, i have tried centOS 6.4, and it gives me the same problem. i mention again that i gave the directory full permission. i ran linux before on other computers and never came across this problem. my computer now is DELL XPS L502X.

Best Answer

The /sys directory in Linux is deceptive. Unlike most other directories, it does not provide persistent storage for arbitrary files.

Rather, it's a way to look at the systems's devices - their states and configurations. These files go away between boots and are dynamically generated by your system at startup. It is normal to be denied permission to write new files or directories there, even as root. You can detect these filesystems by viewing the mount type:

$ mount
none on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600)
none on /proc type proc (rw,nosuid,nodev,noexec,relatime)
none on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
none on /sys/fs/fuse/connections type fusectl (rw,relatime)
none on /run type tmpfs (rw,nosuid,noexec,relatime,size=3284248k,mode=755)
/dev/md2 on /home type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered,discard)
  • devpts, proc, sysfs, binfmt_misc, and fusectl are all dynamically generated filesystems that reflect internal system information, and aren't for normal filesystem use. You will likely get permission denied errors even as root or other issues if you try to use these as a normal filesystem.
  • tmpfs is a temporary filesystem which resides within RAM - You can write to here and use it like a normal filesystem, but anything saved here will be erased as soon as the computer shuts down. Copy your files elsewhere if you want to save them.
  • ext4 is an actual filesystem on a device somewhere. Data saved here will be preserved like you would expect on a harddisk. There are many filesystems, but the key note is how this line has /dev/md2 instead of none: none means that there is no device backing the filesystem - it doesn't really exist, and is entirely virtual. If a mount point has an actual device (like /dev/sda1 or /dev/md1), then that means the contents actually exist on a device somewhere.

Would you be able to put your edited files in another directory? Or do you specifically mean to edit the configuration of a device?

Related Question