2

I need to create a folder in the /usr/share folder to manually put a program into it.

How do you create a folder in the /usr/share folder manually?

1
  • @Minx If any of the answers gave you the solution you were looking for (it looks like you solved it), please mark the answer as accepted for (a.o.) clarity reasons. Feb 18, 2015 at 22:44

4 Answers 4

5

If you want to create a directory named some_dir in /usr/share/ directory you need to issue the following command:

sudo mkdir /usr/share/some_dir

Why sudo:

You might be wondering why you need to use sudo, well the simple answer is that /usr/share has a permission of 755:

drwxr-xr-x 295 root root 12288 Feb 18 21:03 share 

that enables only root to write on this directory meaning only root can create a directory inside this directory.

2
  • Thanks for the advanced look at folder permissions and the use of "sudo" to make additions to those folders.
    – Mlinx
    Feb 18, 2015 at 15:13
  • 1
    @Mlinx: Please mark any of the answers as the answer to your question so that others can be notified that the issue has been resolved.
    – heemayl
    Feb 18, 2015 at 15:21
3

We should not write to or create folders outside our HOME. Restrictive file permission is a feature that allows us to have a secure and stable system.

In case you really have to and you know what you are doing you will need to be logged in to an administrator account where you can always obtain "root" permissions to access anything on your computer.

The command sudo preceding commands in a terminal will temporarily give you root permissions to perform administrative tasks, including creating and deleting directories anywhere. You will usually not be warned if you did something stupid, so irrevrsible damage comes on your own responsibility.

Also read:

Writing to /usr/share will affect all accounts on your computer. In case you only just need your program for your single account it is much safer to store that in a subfolder within a special hidden (.) folder in your home directory: e.g. ~/.local/bin/, ~/.local/sbin/, ~/.local/share/applications/. You will have full permissions on all files there. Downloaded applications with access for all users should go to /opt/.

1

sudo mkdir /usr/share/your_directory_name will do it.

0
1

Alternatively you can create directory or files in /use/share graphically by executing the following command in terminal:

gksu nautilus

You will see file manager but with root access.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .