Results 1 to 7 of 7

Thread: Chown USB disk?

  1. #1
    Join Date
    Oct 2020
    Beans
    11

    Chown USB disk?

    A while back I formatted an external Seagate USB disk and now I have a problem with writing to the disk. It is owned by root, and I can not CHOWN it. I tried some permutations.

    If I go one directory lower and do a
    Code:
    chown daan '/Seagate USB'
    chown: cannot access '/Seagate USB': No such file or directory
    So I have my commands crossed. What do I need to do to be able to backup to my disk?

  2. #2
    Join Date
    Jun 2016
    Beans
    2,249
    Distro
    Xubuntu 20.04 Focal Fossa

    Re: Chown USB disk?

    First make sure the USB disk is mounted. Then open Terminal in the directory that's the exact mount point of the USB disk and run -
    Code:
    sudo chown daan: .
    Xubuntu 20.04/System76 hardware ♦ Pop!_OS/live ♦ Debian 10/Xubuntu 20.04/VirtualBox
    If your questions are resolved to your satisfaction, please use Thread Tools > "Mark this thread as solved..."

  3. #3
    Join Date
    Dec 2014
    Beans
    1,805

    Re: Chown USB disk?

    A hint why your command didn't work: a path beginning with '/' is an absolute path beginning at the root of the file system tree.
    Code:
    chown daan '/Seagate USB'
    would change the ownership of 'Seagate USB' located in the root directory. Either leave off the '/' or give the correct absolute path (probably something like '/media/daan/Seagate USB/').

    Holger

  4. #4
    Join Date
    Jun 2007
    Location
    Arizona U.S.A.
    Beans
    4,956

    Re: Chown USB disk?

    You probably don't have the right path to the disk's filesystem. In Ubuntu, external USBs mount at /media/<username>/<mountpoint-folder-name>

    Find that folder name, then you can formulate your command. You should also use the -R option with chown to make it apply to the folder contents as well as the folder. And, you can change the group owning the filesystem at the same time. The chown command is for ext formatted filesystems (usually ext4).

    If daan is your user name:
    Code:
    sudo chown -R daan:daan /media/daan/<mountpoint-folder-name>

  5. #5
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Chown USB disk?

    chown has 3 requirements:
    • can only be run using sudo/root
    • the file system must be a native Linux with POSIX permission support. This means it will never work on NTFS nor FAT32 nor exFAT file systems.
    • the file system must be mounted read-write


    So, the first things to check are those three.

  6. #6
    Join Date
    Oct 2020
    Beans
    11

    Re: Chown USB disk?

    Thanks for the help. The sudo chown daan: . did work.

  7. #7
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Chown USB disk?

    Quote Originally Posted by daanheuvelbeuk View Post
    Thanks for the help. The sudo chown daan: . did work.
    For the future, there are help pages for almost every command on your Linux system. manpages.
    $ man chown

    Code:
    NAME
           chown - change file owner and group
    
    SYNOPSIS
           chown [OPTION]... [OWNER][:[GROUP]] FILE...
           chown [OPTION]... --reference=RFILE FILE...
    Optional parameters are are in brackets, []. An important note in the manpage:
    Code:
           Owner is unchanged if missing.  Group is unchanged if missing, but changed to login  group  if
           implied  by  a ':' following a symbolic OWNER.  OWNER and GROUP may be numeric as well as sym‐
           bolic.
    So, as long as the FILE is correctly specified, it should work. Adding a colon, like user1: isn't necessary. There is an EXAMPLES section for clarity.

    It is possible to use chown rather than chgrp for group stuff, but only root or the file owner can accomplish that. Directories are considered files, BTW.

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
  •