Results 1 to 9 of 9

Thread: Change Ownership of External USB HDD

  1. #1
    Join Date
    Dec 2007
    Location
    Western U.S.
    Beans
    203

    Change Ownership of External USB HDD

    I bought a brand new 2TB external USB HDD. Using gparted, I deleted the ntfs partition, and created a new partition formatted in ext4.

    Then, I tried to write files to it. I couldn't because root stole my HDD from me! Blast him!

    How do I change ownership of the drive so that I own it and NOT root? (blasted thief!)

    I saw a lot of chmod and chown threads, but they all dealt with files and directories. I want to own the external drive, itself, and all of its contents (when I am finally able to add contents to it).

    Thanks.

  2. #2
    Join Date
    Jan 2008
    Location
    Manchester UK
    Beans
    13,573
    Distro
    Ubuntu

    Re: Change Ownership of External USB HDD

    Quote Originally Posted by DeadlyOats View Post
    I bought a brand new 2TB external USB HDD. Using gparted, I deleted the ntfs partition, and created a new partition formatted in ext4.

    Then, I tried to write files to it. I couldn't because root stole my HDD from me! Blast him!

    How do I change ownership of the drive so that I own it and NOT root? (blasted thief!)

    I saw a lot of chmod and chown threads, but they all dealt with files and directories. I want to own the external drive, itself, and all of its contents (when I am finally able to add contents to it).

    Thanks.
    Imagining it is mounted /media/drive........

    ....... and your username is deadlyoats

    Code:
    sudo chown -R deadlyoats:deadlyoats /media/drive
    Change the imagined stuff to the real thing.

  3. #3
    Join Date
    Dec 2007
    Location
    Western U.S.
    Beans
    203

    Re: Change Ownership of External USB HDD

    Thank you, nothingspecial!

    Thanks for recognising that I am a simple end user and for your very simple explanation.

    Please know that I will always refer to this thread, when I need to do something like this again, in the future.

    I think I see a pattern. It doesn't matter if it's a file name, a folder name, or the name of a drive. It's all done the same way.

    For example:

    sudo chown -R deadlyoats:deadlyoats /media/myharddrive'sname This changed the owner of the drive.

    While this:

    sudo chown -R deadlyoats:deadlyoats /home/folder/subfolder This changed the owner of the directory (folder or subfolder).

    And this:

    sudo chown -R deadlyoats:deadlyoats /home/folder/subfolder/file This changed the owner of the file within a directory.

    1) It's the same command structure. It's just the path that changes. Or am I mistaken?

    2) If the owner of a drive or directory is changed, does that necessarily change the ownership of the contents too?

    3) Also, why "deadlyoats:deadlyoats"? Why is it repeated like that?

    The command you showed me gave me ownership of the drive, but to give myself permission to write to the drive, I right clicked the drive, clicked on properties, clicked on the "Permissions" tab, and changed the "Group" permissions from "Access Files" to "Create and Delete Files". That permitted me to start copying files to the drive.

  4. #4
    Join Date
    May 2010
    Location
    uk
    Beans
    9,249
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: Change Ownership of External USB HDD

    Hi

    To answer your questions.

    1. Yes the pattern is the same (although with the drive it is the mount point that changes ownership)
    2. No it does not
    3. User and group

    Kind regards

  5. #5
    Join Date
    Dec 2007
    Location
    Western U.S.
    Beans
    203

    Re: Change Ownership of External USB HDD

    Many thanks, matt_symes!

    So, then, with the command, as shown above, I am able to change one directory(folder/subfolder) at a time, and within those folders, I can change ownership of the files, one at a time.

    How do I change the ownership of all files and folders within a directory or drive with one command (If you don't mind my asking)?

  6. #6
    Join Date
    May 2010
    Location
    uk
    Beans
    9,249
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: Change Ownership of External USB HDD

    Hi

    There are a couple of ways to do it.

    But first a word of warning

    You _must_ be sure you are doing it correctly and _only_ to the files you want.
    Changing ownership of the files in many system directories will put you in a whole world of pain as many programs and the system itself rely on files having certain permissions and ownerships.
    I am not try to be patronising, i just _really_ dont want you to make a mistake or you will be looking at reinstalling.

    Anyhow, warning over.

    Read this thread. It will save me alot of typing

    http://www.linuxquestions.org/questi...rmited-543589/

    Kind regards
    Last edited by matt_symes; November 17th, 2010 at 12:45 AM. Reason: Added wrong link

  7. #7
    Join Date
    Dec 2007
    Location
    Western U.S.
    Beans
    203

    Re: Change Ownership of External USB HDD

    Thanks again, matt_symes!

    I read the posts at the link you provided. It seems then the -R is what is needed to change ownership of multiple folders and files within a specific directory, and that was already in the command that nothingspecial taught me (sudo chown -R deadlyoats:deadlyoats ...), but correct me if I am mistaken.

    Thanks for your advice and teachings.

  8. #8
    Join Date
    Jun 2010
    Beans
    Hidden!

    Re: Change Ownership of External USB HDD

    try the manual entry for chown
    Code:
    man chown

  9. #9
    Join Date
    May 2010
    Location
    uk
    Beans
    9,249
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: Change Ownership of External USB HDD

    Hi

    Quote Originally Posted by DeadlyOats View Post
    Thanks again, matt_symes!

    I read the posts at the link you provided. It seems then the -R is what is needed to change ownership of multiple folders and files within a specific directory, and that was already in the command that nothingspecial taught me (sudo chown -R deadlyoats:deadlyoats ...), but correct me if I am mistaken.

    Thanks for your advice and teachings.
    Yeah, missed that -R switch. My only excuse is it very late here. Glad its fixed

    Kind Regards

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •