1

I am new to Ubuntu and have a basic question. I made a drive called /storage when I was installing Ubuntu (Is it a drive? or a folder?). And I can not write any file to it right now. Can you please help me with a method to use it.

The result of DF command is:

Filesystem     1K-blocks    Used Available Use% Mounted on
udev             3026364       0   3026364   0% /dev
tmpfs             609236    9060    600176   2% /run
/dev/sda5       19092180 6224536  11874776  35% /
tmpfs            3046164     220   3045944   1% /dev/shm
tmpfs               5120       4      5116   1% /run/lock
tmpfs            3046164       0   3046164   0% /sys/fs/cgroup
/dev/sda7       69110272   53012  65523592   1% /storage
/dev/sda6       19092180 8750784   9348528  49% /home
tmpfs             609236      56    609180   1% /run/user/1000

BR

Zeedo

SuB
  • 4,419
Zeedo
  • 13
  • 4

1 Answers1

1

If you created /storage during the installation, it is probably a partition but for your purposes, you can think of it as a directory.

If you are trying to make a place that only you can store stuff to, you need to:

  1. find out your user name
  2. change the owner of the directory to your user
  3. change the permissions so that only you have access

So first, this will show you your user name:

whoami

You should see something like "zeedo" or whatever you go by locally.

Now, let's find out who owns the directory in question:

ls -ld /storage

I'm guessing the results look something like this:

drwxrwxrwx   2 root root  4096 Jul 18 20:50 storage/

If that's the case, let's change the owner like this:

sudo chown -R zeedo /storage

The "-R" changes it for all files and folders inside the storage directory.

Now if you run:

ls -ld /storage

you should see something more like this:

 drwxrwxrwx   2 zeedo root  4096 Jul 18 20:50 storage/

If the last three letters of the "drwxrwxrwx" above are "rwx", you don't want that. It means that everyone one that computer can view/edit those files/directories. So let's change that:

sudo chmod -R 700 /storage

If you now do this one more time:

ls -ld /storage

You should see something like this:

drwx------   2 zeedo root  4096 Jul 18 20:50 storage/

Which is what you want. In general, you should really create private directories in your home directory like this:

mkdir ~/storage

The ~ is the same as /home/zeedo