Tag Archives: chmod

Ubuntu Terminal: How to View the Current CHMOD Octal Value of a File or Folder Software & Sites 21 MAR 2012

Linux (and thus Ubuntu) file access permissions often get in your way if you aren’t a power user, but if you have played around with the Ubuntu terminal for long enough, you should by now be aware of the magical CHMOD command and the way in which it can alter file and folder permissions.

The most common way of using the chmod command to change file access permissions is by specifying a three digit octal value which then gets interpreted as user access values. But say now you want to view the existing octal access values of a file?

Well, this is a nifty little tip to list the current numeric CHMOD values for all files and folders in the current directory.

Open up a terminal (Ctrl+Alt+T) and run:

stat -c '%A %a %n' *

Using the useful stat function (run ‘man stat’ to learn more), we’ve used the access rights in human readable form, access rights in octal, and finally the file name itself formatting options to achieve our helpful display.

Useful.

Ubuntu Terminal: How to Make a Folder Writable CodeUnit 15 AUG 2011

It is not often that you need to force a folder in Ubuntu to be writable, usually you only sit with this sort of issue when you want to create a space on your web server for users to upload something to or some other similar reason. Anyway, luckily it is a simple matter to make a folder writable via an Ubuntu terminal instance, making use of the classic chmod functionality.

In practice, to make a folder like /home/uploads writable to all, run:

chmod 777 /home/uploads

The value of 7 indicates read, write and execute permissions, with the first 7 standing for the owner, the second for the group and the final one for everyone else.

And that should pretty much do it, though remember a folder with such open permissions is a pretty risky little beast to have lying around.

Nifty.