Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have installed a cable that connects from the CPU's SATA motherboard connection to a removable drives' ESATA connection.

I would like to be able to swap drives on the ESATA connection and have all users be able to read and write to these drives.

I have created the directory /archive/ where I would like the drive(s) to mount.

The drives are all formatted Fat 32 - but in the future I may use HFS for formatting.

When I used the command (as root):

mount /dev/sdc1 /archive

the drive was mounted (but read only)

What can I use in my /etc/fstab file that will allow drives to be mounted and unmounted by all users on the system? (both reading and writing)

Also, will I be able to mount and unmount these drives without shutting down? or will I need to reboot every time I want to change drives?

share|improve this question
    
If you don't want to manually edit anything, there are utilities that can be installed using either Ubuntu's built-in software centre or the package manager that will allow you to configure drives to automount and set the permissions for read/write and mount/unmount. I can't look up any disk managers for you atm 'cause I don't have an Ubuntu box handy so I won't post this as an answer. –  Tog Jan 4 '11 at 19:58
    
please, inform us of which distro you are using. –  Jasen Jan 4 '11 at 20:09
    
This is a RedHat system. "cat /etc/redhat-release Red Hat Enterprise Linux WS release 4 (Nahant Update 3)" –  evilblender Jan 5 '11 at 21:11

2 Answers 2

https://help.ubuntu.com/community/AutomaticallyMountPartitions please try google first next time. and just so you know, no user can log in as root. the su command is necessary for any and all super user operations.

share|improve this answer
2  
1. An answer that just links elsewhere is not a real answer. 2. The "no user can log in as root" statement is a) not related to the question, b) only true for standard Ubuntu Linux setups and not to any other distribution. 3. Regarding "the su command is necessary" - if you cannot login as root, you cannot su to root either. (You can sudo -s on Ubuntu, however.) –  grawity Jan 4 '11 at 19:53
    
Actually, the inability to log in from the welcome screen as root can be bypassed and you most certainly can su to root when logged in as a user after once using a fairly simple command. Other than that, I have to say point one is valid, "be nice". Let's not hijack the OP's question –  Tog Jan 4 '11 at 20:11
    
@Tog alright. i shall remove my comments. –  Jasen Jan 4 '11 at 20:20

What can I use in my /etc/fstab file that will allow drives to be mounted and unmounted by all users on the system? (both reading and writing)

If it's a personal computer, it would be best to use something like udisks (which GNOME uses for (auto-)mounting devices), as in udisks --mount /dev/sdc1.

Another alternative is pmount.

But if you require it to work with the mount utility, and if you can guarantee that the device node will never change, this should work:

/dev/sdc1  /archive  auto  users,uid=0,gid=0,fmask=0111,dmask=0,file_umask=0111,dir_umask=0,utf8  0  0

fmask/dmask are for msdos/vfat filesystems, file_umask/dir_umask are for hfs. In both cases, all files have permissions 0666 and directories 0777.


Edit: This could help. Run through sudo.

#!/usr/bin/env bash
device=/dev/sdc1
mountpoint=/archive
# You can also use "uid=$SUDO_UID,gid=$SUDO_GID"
options="users,uid=0,gid=0,utf8"
# sets TYPE to the detected type; also UUID, LABEL where supported by filesys.
. <(blkid -c /dev/null -o export "$device")
case $TYPE in
vfat) options="$options,fmask=0111,dmask=0" ;;
hfs)  options="$options,file_umask=0111,dir_umask=0" ;;
esac
mount -t "$TYPE" -o "$options" "$device" "$mountpoint"
share|improve this answer
1  
This is extraordinarily helpful thank you! I used the line you gave, and I am getting an odd error message. when I then 'mount -a' I'm told that "mount: you must specify the filesystem type" I don't know if this matters - but this is a Red Hat system, and not running GNOME. –  evilblender Jan 5 '11 at 20:47
1  
@evilblender: Try replacing auto in the third field with vfat or hfs, depending on what you are using. (I suggest using something more reliable than that, however. Both ext4 and ntfs-3g have journalling and even support chown+chmod.) –  grawity Jan 5 '11 at 20:52
    
Unfortunately the archive drives have previously been formatted both vfat as well as hfs. Does this kind of screw me? Thanks again. Jeff –  evilblender Jan 5 '11 at 21:06
1  
@evilblender: Take a look at udisks and pmount, then? (sudo can be useful too, possibly with a script that detects the filesystem with blkid before giving it to mount - without a fstab entry.) –  grawity Jan 6 '11 at 17:17
1  
@grawity thank you very much, I will look at them ASAP –  evilblender Jan 6 '11 at 23:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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