2

I have a secondary internal HDD formatted to ext4. How can I enable full permissions so that I, other users, and the Samba network can read, write, and execute from the hard drive? Using Ubuntu 19.04.

Problem: Currently on the second hard drive I can access documents and create and delete files in nautilus file manager. But I cannot edit files directly from apps.

For example, if I try to edit a photo in Gimp, I receive an error message that "permission is denied". This applies across all apps. Photo attached.

Current State: Every time I need to use a file or upload to an app (such as the Wordpress gallery), I have to copy the file to my primary OS HDD and use it from there. My current Fstab settings are:

#The 1.7tb ext4 Seagate Drive
/dev/disk/by-uuid/6ae9faae-3242-4023-9137-8cdf65bc5d96 /mnt/6ae9faae-3242-4023-9137-8cdf65bc5d96 auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=Casa%20Storage 0 0

I have read tutorials, videos, and AskUbuntu responses, but I can't seem to make it work.

Desired solution: I would like to be able to use the secondary internal HDD as if it was my main hard drive with full permissions.

A second bonus would be to have all my users on my home network gain full access to the drive as well.

Error Message

Permissions Settings

enter image description hereenter image description here

NEWEST SCREENSHOTS Files from the drive are still not accessible by certain applications. While GIMP is one application that can't access the files from the external drive, other programs like VLC can't open the files. I also can't upload to the Wordpress gallery in a web browser. It's mysterious, but hopefully there's an answer out there.

enter image description here

enter image description here

enter image description here

11
  • 1
    Thanks, the edits are done.
    – Rockishi
    Feb 2, 2020 at 22:01
  • 1
    How is Gimp installed? Some packagings (snap, among others) sandbox the application by default.
    – xenoid
    Feb 6, 2020 at 17:51
  • 1
    Thank you for the fantastic answer. Your answer was the clearest explanation of setting up the hard drives that I have seen. I was able to mount the drive and set up the local share. However, I am still getting an error from GIMP, but this time that the file location doesn't exist. I haven't had a chance to return to the issue, but I will look at it in the next few days and attempt to modify files using different programs. I'll report back soon with screenshots.
    – Rockishi
    Feb 8, 2020 at 0:24
  • Thank you, I will look into changing the GIMP snap settings. I do notice the problem extends beyond GIMP. VLC won't recognize music files. Images can't be uploaded to wordpress from a web browser, instead they have to be transferred to the primary OS M.2 drive and uploaded from there. (This was how I first noticed the problem). But PDFs can be opened and text documents can be edited and saved without a problem. I have added new screenshots in the main question section.
    – Rockishi
    Feb 10, 2020 at 23:48
  • All the programs having difficulty opening files from the drive are not snap apps. There exists some problem with the permissions of the drive. Do you believe that reformatting the drive and following your instructions below from scratch would make any difference?
    – Rockishi
    Feb 15, 2020 at 19:52

1 Answer 1

0

Your second hard drive's mount-point seems a bit weird to me. Here is the way to fix it. This involves:

  1. Creating a new mount-point and
  2. Editing the /etc/fstab file to automatically mount the drive at the new mount-point.

What mount-point?

Simply put, a mount-point is a an empty folder where the drive will be mounted. For a permanently attached hard drive that is going to be mounted automtically when the system boots, I like to create the mount-point at the root of the system folder /, such as /bigdrive. Other popular choices are mount-points /mnt/bigdrive or /media/bigdrive. See Why have both /mnt and /media?

The tradition of mounting partitions (of hard drive) as a sub-folder of /mnt/ comes from the days when one needed to manually mount the tape drives that were then attached to the system. This involved lifting a roll of magnetic tape and mounting it on a peg inside a cabinet sized computer:

The mount-point that are sub-folders of /media/ are usually automatically generated when an external drive, usually USB drive is attached in modern Ubuntu computers.

Creating a mount-point

Open a terminal by pressing Ctrl+Alt+T and enter:

sudo mkdir /bigdrive
sudo chmod -R 777 /bigdrive

If you prefer the graphical way Open Nautilus as root. How do I start Nautilus as root?

  • Navigate to the / and create a new folder called /bigdrive
  • Right click on and choose Properties.
  • Go to the Permissions tab.
  • Make sure the Group and Others can Create and Delete Files.

enter image description here

  • Click on "Change permissions of enclosed files" button and make sure it looks like this:

enter image description here

Edit /etc/fstab

Let us make a copy of the original fstab file before we start editing:

sudo cp /etc/fstab /etc/fstab.old

To edit the /etc/fstab I use nano:

sudo nano /etc/fstab

Comment out the existing lines related to the internal big drive by putting a # at the beginning of the line like this:

#The 1.7tb ext4 Seagate Drive
#/dev/disk/by-uuid/6ae9faae-3242-4023-9137-8cdf65bc5d96 /mnt/6ae9faae-3242-4023-9137-8cdf65bc5d96 auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=Casa%20Storage 0 0

Add the following line:

UUID=6ae9faae-3242-4023-9137-8cdf65bc5d96 /bigdrive ext4 defaults 0 0

Note: the UUID is unique to each partition. So everyone should use the correct UUID for their own hardware. Do not copy it from here.

Press Ctrl+O followed by Enter to save the file and Ctrl+X to exit nano.

Test it out:

The following steps will unmount the drive from its old mount-point:

sudo umount /mnt/6ae9faae-3242-4023-9137-8cdf65bc5d96

You can type the first 2 or three numbers and letters of the long file name and press Tab in the terminal to auto-complete the rest of the name.

Then mount it at the new mount-point with the new options set in the /etc/fstab:

sudo mount -a

If all goes well you should find the existing files and folders inside /bigdrive.

Setup Samba

Based on your question I assume you have other computers running Windows and you want to setup Samba for sharing the /bigdrive with other computers running either Windows or Ubuntu.

Step 1 Open Nautilus normally and navigate to / from + Other Locations on the left pane. Right click the /bigdrive folder icon and choose "Properties" and click on the "Local Network Share" tab:

enter image description here

Check the box "Share this folder."

You may also want to check the other two boxes "Allow others to create and delete files in this folder." This will allow you the desktop Windows user to create and delete files on this folder.

The "Guest Access" check box is self explanatory. This may be useful if your Windows userID is not exactly the same as your Ubuntu user ID.

It may tell you Sharing service is not installed:

enter image description here

Click "Install Service" and let it install the software by providing the password when it prompts. You may be prompted to install more software like libpam-smbpass. Install all the software. It will ask you to restart services and click Yes.

Step 2. Go to the permissions tab and make sure it looks like this:

enter image description here

Click on "Change permissions of enclosed files" button and make sure it looks like this:

enter image description here

Now you should be able to edit files created in Ubuntu in the /bigdrive folder.

However, if you create a file in a Windows computer and put it in this folder using Samba you may not be able to open that file when you get back to this computer. This is because Windows and Ubuntu do not understand each other's file ownership and permissions. So in the Ubuntu laptop, the file created by Windows is owned by "Nobody". You will have to open Nautilus as Administrator and change the ownership and read-write permissions while in the laptop.

Step 3. Go to the Windows on the other computer and open Windows Explorer, Click on the triangle next to Network on the left panel. From the drop-down list you should be able to select the name of the computer running Ubuntu with /bigdrive.

Now you should be able to see your shared folder (say "BigDrive") from this Ubuntu computer in the Windows Explorer. Click on "bigdrive" folder and see the files in the folder. You should be able to copy files from the Public folder in Ubuntu to your Windows local folder.

Here is a step by step guide with some more details.

The Samba section of the answer is based on this answer. Read the whole answer for network file sharing using sftp if your network consists of only Ubuntu computers and now Windows.

Hope this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.