permissions denied for an external hard disk

8,474

A more detailed answer:

1) If you intend to leave this drive attached to the system and want it available to other users:

$ sudo umount /mnt
$ sudo mkdir /mnt/maxtor
$ sudo echo "/dev/sdb1 /mnt/maxtor ext4 errors=remount-ro 0 1" >> /etc/fstab
$ sudo mount /mnt/maxtor
$ sudo chmod 1777 /mnt/maxtor
$ sudo chown -R <you>:<your group> /mnt/maxtor/*

Now, any user should be able to create files on the drive but you can only delete/modify files you own.

2) If this drive is only for your use:

$ sudo umount /mnt

Unplug the drive and plug it back in. The drive should automagically mount at /media/<you>/<drive name>, and it will only be accessible by you.

Share:
8,474

Related videos on Youtube

user8003788
Author by

user8003788

Updated on September 18, 2022

Comments

  • user8003788
    user8003788 over 1 year

    I am new to all of this so sorry in advance! I bought an external hard disk (Maxtor M3 portable) and I already mounted it to use it with my linux. After copying the jpg images from my samsung to linux and then to the hard disk, I tried to preview them but each time I receive a message telling me " failed: Permission denied".

    After reading here, I used gksudo nautilus and it worked successfully, I was able to see the pictures.

    I am looking now for a durable solution! I would like to know how can I fix my hard disk so that I can preview the images without the use of gksudo nautilus each time?

    EDIT: Again I am sorry if this is not the right place to post my question, thanks to any advice concerning the right place. Also, I would be very happy to provide any information or to answer any question regarding my problem.

    • Wayne Vosberg
      Wayne Vosberg over 4 years
      How are you mounting it in LInux? What commands did you use to copy the files to the drive? What is the output of ls -ld /maxtor/mount/point?
    • user8003788
      user8003788 over 4 years
      ** mount /dev/sdb1 /mnt AND then ** sudo mkfs.ext4 /dev/sdb1 ..............To copy "" sudo cp -R LocationofTheHardDisk LocationofTheWantedFile ""
    • user8003788
      user8003788 over 4 years
      @WayneVosberg But with sudo ls -ld /maxtor/mount/point......... No such file or directory!!! What I am missing?
    • Ray Butterworth
      Ray Butterworth over 4 years
      When you get the "permission denied", are you running the command as root (sudo)? If it works okay as root, I suspect the files and directories are all owned by root and have insufficient permissions to allow your personal account to see them.
    • Wayne Vosberg
      Wayne Vosberg over 4 years
      /maxtor/mount/point is where you mounted your drive. You can get it from df if you don't remember.
    • Wayne Vosberg
      Wayne Vosberg over 4 years
      I see from your other response - you mounted the drive at /mnt and then copied the files using sudo. So they are all owned by root. Try sudo chown -R <you>:<your group> /mnt
  • user8003788
    user8003788 over 4 years
    following the instruction in case 2, I got "umount: /mnt: not mounted" !..........whereas when doing "sudo umount -l <hard disk location> " worked for unmounting. In contrary unmounting didn't solve the issue!
  • Wayne Vosberg
    Wayne Vosberg over 4 years
    Does df show the drive as mounted? umount -l will not unmount the drive till it is no longer busy -- so it may not have actually done it yet.
  • Wayne Vosberg
    Wayne Vosberg over 4 years
    Did you do umount -l /mnt or is /mnt not really the current mount point?
  • user8003788
    user8003788 over 4 years
    Yes it does " /dev/sdb1 961301032 4002708 908443940 1% /media/...."
  • user8003788
    user8003788 over 4 years
    Since " df" showed the drive mounted and from this " umount: /mnt: not mounted " I got that it is not mounted then I think it is not the mount point!
  • Wayne Vosberg
    Wayne Vosberg over 4 years
    OK - so when you unplugged and replugged it mounted in the proper place - so if you haven't updated ownership you should do it now: sudo chown -R <you>:your group> /media/<you>/<drive> and from now on it should be good.