Find the answer to your Linux question:
Results 1 to 4 of 4
Hi folks, I have a HD mounted on USB enclosure. Please advise how to allow user=satimis to mount the USB enclosure (USB drive). Tks The HD has 2 partitions, /dev/sda1 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Guru
    Join Date
    Sep 2004
    Posts
    1,763

    How to enable user to mount USB enclosure


    Hi folks,

    I have a HD mounted on USB enclosure. Please advise how to allow user=satimis to mount the USB enclosure (USB drive). Tks

    The HD has 2 partitions, /dev/sda1 and /dev/sda2
    corresponding mount points /media/disk /media/disk-1

    # ls -l / | grep media
    Code:
    drwxr-xr-x  4 root root  4096 Oct 20 08:41 media
    # ls -l /media
    Code:
    total 8
    drwxrwxrwx 2 satimis satimis 4096 Oct 16 16:14 disk
    drwxrwxrwx 2 satimis satimis 4096 Oct 16 13:33 disk-1
    I need to copy directories and files from /home/satimis on the HD preserving their owner and permission.

    FS on /dev/sda1 msdos
    FS on /dev/sda2 ext3
    FS on gentoo ext3

    Can I copy directories/files on /dev/sda1? It is running on msdos fs.


    TIA


    B.R.
    satimis

  2. #2
    Linux Enthusiast apoorv_khurasia's Avatar
    Join Date
    Feb 2005
    Posts
    624
    first edit your fstab and add this line or modify the existing line for usb to look something like this
    Code:
    /dev/sda1               /mnt/usb        subfs       fs=auto,rw,users         0 0
    Next add yourself in the usb group. Enjoy!!!
    "There is no sixth rule"
    --Rob Pike
    Registered Linux User: 400426 home page

  3. #3
    Linux Guru
    Join Date
    Sep 2004
    Posts
    1,763
    Hi apoorv_khurasia,

    Tks for your advice.

    Next add yourself in the usb group.
    $ cat /etc/group | grep usb
    No printout.

    What shall I add on /etc/group? TIA

    B.R.
    satimis

  4. #4
    Linux Enthusiast apoorv_khurasia's Avatar
    Join Date
    Feb 2005
    Posts
    624
    I have two solutions coming to my mind right now.

    1. Go ahead with the first part (the fstab one) and do check what device (sda, sda1, sdb???) is your usb. If you can mount-umount your drive without being root than all's done....

    2. If you can do so as root (which I believe you should be able to do) then try this. emerge sudo (if its already emerged then go ahead) and create a group called usb (as root)
    Code:
    user # \su -
    Password:
    root # groupadd usb
    Then edit the sudo file and allow all users in the usb group to mount/umount usb drives.

    How to do this?

    Make a script called mountusb and place it in /sbin. The contents of the script should be
    Code:
    #!/bin/sh
    mount /mnt/usb
    Do this now
    Code:
    root # chmod +x /sbin/mountusb
    root # visudo
    The last command above will open a file (/etc/sudoers) if sudo is correctly installed on your system. Add this line to the end of the file:
    Code:
    %usb    <your-machine-hostname>=/sbin/mountusb
    Mine looks like this: (my machine is turing.iitd.ac.in)
    Code:
    %usb turing=/sbin/mountusb
    Now add yourself to usb group:
    Code:
    root # moduser -G usb <user-name>
    Re-login as a normal user now (kill -1 -1 and then login) and try mounting usb drive. Let me know if it works/fails.

    Good Luck!!!
    "There is no sixth rule"
    --Rob Pike
    Registered Linux User: 400426 home page

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •