Linux mount all user

How do I auto mount a USB drive that all users can write to?

I’m trying to set up a Raspberry Pi to run BitTorrent Sync to back up my files to an external hard drive, but I’m running into some frustrating issues. First, I need to set up the USB hard drive to auto-mount on boot, because the power frequently goes out where I live. So, I added a line to /etc/fstab

/dev/sda1 /media/josiah vfat defaults 0 0 

I rebooted, and it mounted the drive, but then btsync couldn’t write to it. So, I did a little reading and found that you have to specify the user option, so I tried this;

/dev/sda1 /media/josiah vfat defaults,user 0 0 
/dev/sda1 /media/josiah vfat rw,auto,user,async,suid,dev,exec 0 0 

I thought it was working, but then btsync started complaining again that it couldn’t write to the drive, and when I tried to unmount it as a normal user it said that only a super user can unmount the drive. That’s confusing to me, since I thought that’s what the user option was for. What am I missing, or doing wrong?

4 Answers 4

You can do a chmod after you mounted the partition, but that wouldn’t be persistent accross reboots.

You should try this fstab line:

/dev/sda1 /media/josiah vfat user,umask=0000 0 0 
mount -t vfat -ouser,umask=0000 /dev/sda1 /media/josiah 

That will make the mounted partition world readable and writable.

If you need a less permissive setup, you should create a new group and mount as follows:

mount -t vfat -ouser,gid=1010,umask=0007 /dev/sda1 /media/josiah 

It assumes your new group’s gid is 1010. All users that need access to the mountpoint will need to be added to the new group.

Читайте также:  Red hat linux kickstart

Edit the permissions for the mount directory.

In your case, chmod 777 /media/josiah ought to do the trick quite nicely.

have you tried mounting the directory manually and attempted a basic copy/write with a standard user?

@JosiahSprague : Scandalists answer is not correct. You can’t chmod a vfat mount. You can for NTFS if it’s configured correctly. You will have to set the permission in the fstab. Refs: arstechnica.com/civis/viewtopic.php?f=16&t=724261 . forums.justlinux.com/…

The «user» option just let the user mount the device, it has no relation to access rights for the file.

As in gnp answer, see «uid»/»gid» and «umask» option.

FWIW: “when I tried to unmount it as a normal user it said that only a super user can unmount the drive. That’s confusing to me, since I thought that’s what the user option was for.”

User option means that only the user that mounted a filesystem can unmount it again. In your case, it seems that the drive was mounted during the startup, before you login – it means it was a super user mount. If any user should be able to unmount it, then use users instead of user in the fstab line. For more details, see man mount and/or man fstab.

(The solution of the problem itself was already explained – to make the drive all users writable, use umask/dmask/fmask options in fstab, eventually combined with uid/gid options. Again, man mount and/or man fstab will help. Chmod on vfat is really impossible, as a fat filesystem simply knows nothing about access rights.)

Источник

linux mount rw for all users

Step 1) Go to “Activities” and launch “Disks.” Step 2) Select the hard disk or the partition in the left pane and then click on the “Additional partition options,” which is represented by the gear icon. Step 3) Select “Edit Mount Options…”.

How do I mount a drive in Ubuntu?

  1. 2.1 Create a mount point. sudo mkdir /hdd.
  2. 2.2 Edit /etc/fstab. Open /etc/fstab file with root permissions: sudo vim /etc/fstab. And add following to the end of the file: /dev/sdb1 /hdd ext4 defaults 0 0.
  3. 2.3 Mount partition. Last step and you’re done! sudo mount /hdd.
Читайте также:  Linux самый похожий windows

How do I know if my USB is mounted Linux?

sudo lsusb will tell you what USB devices Linux detects. Whether a USB storage device mounts, or is detected, are separate issues. sudo lsusb -v will give verbose output, possibly more information than you want if the OS truly doesn’t recognize the device. This will give you a number of recognized devices.

Where are USB drives mounted in Linux?

Once you attach a device to your system such as a USB, especially on a desktop, it is automatically mounted to a given directory, normally under /media/username/device-label and you can then access the files in it from that directory.

How do I mount a hard drive in Linux?

  1. Step 1: Plug-in USB drive to your PC.
  2. Step 2 – Detecting USB Drive. After you plug in your USB device to your Linux system USB port, It will add new block device into /dev/ directory. .
  3. Step 3 – Creating Mount Point. .
  4. Step 4 – Delete a Directory in USB. .
  5. Step 5 – Formatting the USB.

How do I check mount permissions in Linux?

  1. Listing the file system. findmnt. .
  2. Files system in a list format. findmnt –l. .
  3. Listing the system in df format. .
  4. fstab output list. .
  5. Filter out file system. .
  6. RAW OUTPUT. .
  7. Search with source device. .
  8. Search by mount point.

How do I change the mount point in Linux?

  1. First login as root user on Linux.
  2. Move to /etc directory by issuing command cd /etc as shown in below screenshot.
  3. Open the fstab file using any text editor. .
  4. Now replace the /home wherever seen in in the fstab file with /u01 ( the new name of the mount point )

How check mount point in Linux?

The findmnt command is a simple command-line utility used to display a list of currently mounted file systems or search for a file system in /etc/fstab, /etc/mtab or /proc/self/mountinfo.

How to Install Visual Studio Code on Debian 9

Code

How do I download Vscode Debian?How do I install Visual Studio code in terminal?How do I install Visual Studio on Linux?How do I run a Visual Studio c.

Читайте также:  Linux pxe server centos

How to Install and Use MySQL Workbench on Ubuntu 18.04

Mysql

Install and Get Started with MySQL Workbench on Ubuntu 18.04Download and Install MySQL Workbench.Launch MySQL Workbench.Configure MySQL Workbench.Conn.

How to update Grub in Arch Linux

Grub

How do I update my bootloader Arch?How do I update-grub?How do I change GRUB bootloader in Linux?How do I update-grub manjaro?How do I reinstall grub .

Latest news, practical advice, detailed reviews and guides. We have everything about the Linux operating system

Источник

Modify fstab entry so all users can Read and Write to an EXT4 Volume

I have an Ubuntu 10.04 box with an EXT4 partition. This partition is set to automatically mount in /etc/fstab . For the purposes of this post, we’ll call it: /media/foo . Unfortunately, only root can create/delete files/directories on the root filesystem of foo . For other users to perform file/io on this volume, root needs to create a directory and chmod the permissions to others. I would like to mount the volume such that anybody would be able to read/write to the volume without the need of root to chmod . Below is my fstab entry:

/dev/sda8 /media/foo ext4 rw,user,exec 0 0 

The entry originally had defaults instead of rw,user,exec . I added the additional entries, namely, rw so any user can read/write. Unfortunately, the fstab entry does not work. It mounts fine, but it still requires root to intervene. And, just in case anybody asks, simply running: chmod -R 777 * on /media/foo as root does not work.

8 Answers 8

The mount option user only allows the filesystem to be mounted by any user. The rw option makes the filesystem not readonly. You will have to use permissions to make the parent directory writeable.

The chmod command you show only affects the existing files within /media/foo .

@DennisWilliamson Thanks. I’ve put it into /etc/rc.local if it makes any difference. What bugs me overall about this though, is that it really should be configured in fstab . If not, mount point can change, and scripts have to change too, maintenance hell.

Источник

Оцените статью
Adblock
detector