3

I am really new to Ubuntu and I'm so confused, so please excuse my ignorance.

I have two drives on my computer an 80gig and 500gb. I have Ubuntu installed on the 80gb drive but have all my media on the 500gb drive. I have changed the directory setting for my music and video files to look at the 500gb harddrive instead of the original default folder on the drive that Ubuntu is installed on. However, when I tried to add files to my music and video folders on the larger drive I apparently do not have permission to do that or modify the folder in any way at all since it is owned by root.

I have tried a couple of suggestions posted in this forum but I can't seem to find anything that works and I keep getting operation not permitted. Can someone please provide me with a step by step idiot's guide to changing my permissions? Maybe I have even set everything up incorrectly. I am willing to remount the drive or anything that's necessary (I have everything backed up on an external drive).

3 Answers 3

9

To change ownership of your files and folders in your hard drive

sudo chown -Rv username /path-to-your-secong(500GB)-hdd

R stands for recursive & v to verbose the output

Here a simple tutorial about chown

< chown - change the owner of a file >

You can change the owner and group of a file or a directory with the chown command. Please, keep in mind you can do this only if you are the root user or the owner of the file.

Set the file's owner:

chown username somefile

After giving this command, the new owner of a file called somefile will be the user username. The file's group owner will not change. Instead of a user name, you can also give the user's numeric ID here if you want.

You can also set the file's group at the same time. If the user name is followed by a colon and a group name, the file's group will be changed as well.

chown username:usergroup somefile

After giving this command, somefile's new owner would be user username and the group usergroup.

You can set the owner of a directory exactly the same way you set the owner of a file:

chown username somedir

Note that after giving this command, only the owner of the directory will change. The owner of the files inside of the directory won't change.

In order to set the ownership of a directory and all the files in that directory, you'll need the -R option:

chown -R username somedir

Here, R stands for recursive because this command will recursively change the ownership of directories and their contents. After issuing this example command, the user username will be the owner of the directory somedir, as well as every file in that directory.

Tell what happens:

chown -v username somefile

Output is:

changed ownership of 'somefile' to username

Here, v stands for verbose. If you use the -v option, chown will list what it did (or didn't do) to the file.

The verbose mode is especially useful if you change the ownership of several files at once. For example, this could happen when you do it recursively:

sudo chown -Rv username somedir

Output is:

changed ownership of 'somedir/' to username 
changed ownership of 'somedir/boringfile' to username 
changed ownership of 'somedir/somefile' to username
0
2

I would be curious to see how you mounted the 500GB drive. Whenever I ran into this issue myself it would always be that I placed the incorrect permissions on the drive. While 777-ing the directory structure will work, it is not exactly the most secure way of solving the problem.

To try and the solve this problem I would take a closer look at how you mounted the drive. This might be a good guide: https://help.ubuntu.com/community/AutomaticallyMountPartitions#Systemwide_Mounts

7
  • is there anything you need from me...I'm so confused..
    – Terrence.S
    Sep 29, 2012 at 4:13
  • 1
    can you please post the contents of your /etc/fstab file? You can see it if you type less /etc/fstab in a terminal.
    – eltommo
    Sep 29, 2012 at 4:58
  • # <file system> <mount point> <type> <options> <dump> <pass> proc /proc proc nodev,noexec,nosuid 0 0 # / was on /dev/sda6 during installation UUID=045cabcf-fc7c-4fd2-b1e8-030fb069e3c0 / ext4 errors=remount-ro 0 1 /dev/sdb1 /media/500GB vfat uid=terry 0 1
    – Terrence.S
    Sep 29, 2012 at 14:34
  • # /windows was on /dev/sda2 during installation UUID=F328-FCD2 /MainDrive vfat utf8,umask=007,gid=46 0 1 # swap was on /dev/sda5 during installation UUID=506d3665-b66b-468c-8b45-0680b317ea7e none swap sw 0 0 /dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
    – Terrence.S
    Sep 29, 2012 at 14:35
  • /dev/sdc1 /media/MainDrive vfat defaults 0 0 /dev/sde1 /media/sde1 vfat uid=terry 0 0 /dev/sdd1 /media/sdd1 ntfs defaults
    – Terrence.S
    Sep 29, 2012 at 14:35
0

You can do man chown at any time and it will give a synopsis of the general look to the command

SYNOPSIS
       chown [OPTION]... [OWNER][:[GROUP]] FILE...

chown user:users gives ownership to the user and to group users

and you can add the options too, R or v

R is recursive when using this command in a folder

v is for verbose output

If you know the synopsis of the command you can reference the options in the Manual

You must log in to answer this question.

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