Mounting USB drive as regular user (with ntfs-3g)

Hello. First of all, I not asking to do the homework for me, rather is someone can help me understand why I can't get this work.
I spent the last night trying to figure how mount an USB drive as a regular user, using ntfs-3g. I read the related wiki entries and researched quite a lot in the forums. I came up with this:
fstab:
# /etc/fstab: static file system information
# <file system> <dir> <type> <options> <dump> <pass>
devpts /dev/pts devpts defaults 0 0
shm /dev/shm tmpfs nodev,nosuid 0 0
#/dev/cdrom /media/cd auto ro,user,noauto,unhide 0 0
#/dev/dvd /media/dvd auto ro,user,noauto,unhide 0 0
#/dev/fd0 /media/fl auto user,noauto 0 0
/dev/sda1 / ext3 defaults,noatime 0 1
/dev/sda2 /home ext3 defaults,noatime 0 2
/dev/sda3 swap swap defaults 0 0
/dev/sdb1 /mnt/usb ntfs-3g noauto,uid=0,gid=0,noatime,umask=000, 0 0
I created a ntfsuser group, added my user to that group and trim permissions to the ntfd-3g executable (link in this post). That allows me mount the partition as root and read/write as regular user. It works, so (i think) not big deal here.
However if I add user to the mount options the following error shows up:
Mount is denied because setuid and setgid root ntfs-3g is insecure with the
external FUSE library. Either remove the setuid/setgid bit from the binary
or rebuild NTFS-3G with integrated FUSE support and make it setuid root.
Please see more information at http://ntfs-3g.org/support.html#unprivileged
What bugs me the most is I don't understand why I can't mount as regular user when the user option is set in the fstab. Shouldn't that allow regular users to mount and unmount? Is not like that I'm mounting and dismounting USB drives every 5', but I would like to get this done because I know it can be done
Sorry for asking such trivial question, but I sense that I'm missing something really stupid and I just can't figure what it is

Beware of the double post! (+1)
Ok, I decided I'd get this to work, although the method and the implications it could have might not seem pretty to some. There are certain conditions for a user to mount any ntfs volume with ntfs-3g, I will name them here:
1. ntfs-3g with integrated fuse support. You'll get this by:
    1A. Removing ntfs-3g and fuse from your system if you have them installed as separate packages, so do this as root:
pacman -Rn ntfs-3g
pacman -Rn fuse
Now you can install the new package.
    1B. Getting a modified version of the PKGBUILD found in that AUR link previously mentioned by me, here's mine:
# Maintainer: Gula <gulanito.archlinux.org>
# Slightly modified by anderfs
# Don't forget to setuid-root for the ntfs-3g binary after you install this
pkgname=ntfs-3g-fuse-internal
pkgver=2010.5.16
pkgrel=1
pkgdesc="Stable read and write NTFS driver (whit internal fuse suport)"
url="http://www.tuxera.com"
arch=('i686' 'x86_64')
license=('GPL2')
depends=('glibc')
conflicts=('ntfs-3g')
makedepends=('pkgconfig')
options=('!libtool')
source=(http://www.tuxera.com/opensource/ntfs-3g-${pkgver}.tgz
http://aur.archlinux.org/packages/ntfs-3g-fuse-internal/ntfs-3g-fuse-internal/25-ntfs-config-write-policy.fdi)
sha1sums=('895da556ad974743841f743c49b734132b2a7cbc'
'200029f2999a2c284fd30ae25734abf6459c3501')
build() {
cd "${srcdir}/ntfs-3g-${pkgver}"
ac_cv_path_LDCONFIG=/bin/true ./configure --prefix=/usr \
--with-fuse=internal --disable-static || return 1
make || return 1
package() {
cd "${srcdir}/ntfs-3g-${pkgver}"
make DESTDIR="${pkgdir}" install || return 1
ln -s /bin/ntfs-3g "${pkgdir}/sbin/mount.ntfs" || return 1
install -m755 -d "${pkgdir}/usr/share/hal/fdi/policy/10osvendor"
install -m644 "${srcdir}/25-ntfs-config-write-policy.fdi" "${pkgdir}/usr/share/hal/fdi/policy/10osvendor/" || return 1
Save this as PKGBUILD, preferrably in an empty directory so it doesn't clutter things up when you build it.
    1C. Now go to the directory where you saved it and do this as a regular user:
makepkg PKGBUILD
After that's done, you'll get a package called ntfs-3g-fuse-internal-2010.5.16-1-i686.pkg.tar.xz, or something similar.
    1D. Install that package as root:
pacman -U ntfs-3g-fuse-internal-2010.5.16-1-i686.pkg.tar.xz
If all went well you now have ntfs-3g compiled with integrated fuse support.
2. The ntfs-3g version must be higher than 1.2506, this is already covered, the package installed from AUR matches this requirement.
3. The ntfs-3g binary must be set to setuid-root, to accomplish this you shall do the following as root:
chown root $(which ntfs-3g)
chmod 4755 $(which ntfs-3g)
I used 4750 instad of 4755, I guess that last bit can be a matter of personal taste as long as it isn't something obnoxious like "7".
4. The user must have the right access to the volume. Okay, this is the ugly part, volumes are owned by root and managed by the disk group with permissions brw-rw----, this means you have to add any users you want mounting this volume to the disk group.
    4A. So, do this as root:
gpasswd -a [user] disk
Where [user] is obviously the name of whichever user you're adding to the disk group, do this for any user you want mounting this volume.
    Any users currently logged in will have to log out and back in for these change to take effect, this most likely includes you.
    4B. Now that you logged back in, try this:
groups
One of the groups listed should be disk, if it's not there you didn't completely log out of all open sessions.
5. The user must have the right permissions/access to the mount point. For a user to be able to mount something to a mount point, that user needs to have read permission (pretty self-explanatory), write permission (so the user can make any changes to the sub-structure of the mount point), and execute permission (so the user can change-dir to that mount point) to it. Mount points can be anywhere, so this really depends where you're mounting.
In my case, I'm mounting these volumes on certain directories under /mnt/, for example /mnt/example. If you're mounting stuff there, you might as well take advantage of the fact your "mounting user" is already in the group disk, and do the following as root:
chgrp disk /mnt/example
chmod 774 /mnt/example
Now users in the disk group will be able to manage these mount points.
6. Mount it. That's it, you should now be able to mount ntfs volumes as an "unpriveleged enough" user. Here's an example of what you'd have to put in /etc/fstab:
UUID=XXXXYYYYXXXXYYYY /mnt/example ntfs-3g noauto,noatime,user,uid=0,gid=6,fmask=137,dmask=027,rw 0 0
uid=0 means root will be the owner of this mount-point and anything in it after it's mounted. This is due to the fact that even though users might own their mountpoints and have rwx permissions on them, you might still not want them to write to the mounted ntfs volumes. Remove this if you want them to be able to write to the volume.
gid=6 means this will be managed by the disk group in my system. Perhaps the disk group has a different id in your system, run "id root" to find out, as root usually is part of this group.
fmask = 137 means the owner (root) can do anything with files in this volume except executing files. Group members (disk) can only read files here, not create or execute them. And other users can't do anything in this volume.
dmask = 027 means the owner can do anything with directories (execute here is needed to chdir), users can't write directories but they can read or execute in them (once again, needed by 'cd'), and finally other users still don't have any access.
You can use whichever fmask and dmask makes sense to you, or use an umask instead.
Last edited by anderfs (2010-07-15 11:34:48)

Similar Messages

  • Mounting USB Drive in Single user mode

    My Intel Imac fails to boot up. fsck -y fails too ... can't think of any other way to get my data out ...
    I am left with the only option to copy my data into my usb drive in the terminal mode .
    But I am unable to mount my USB drive. I also need to know the mount point. can anyone provide me with help.

    The mountpoint can be anything you want. The tricky part is figuring out the device your drive is using. I don't know for sure (can't test it right now), but dmesg or one of the system logs might have that information in it if you boot to SUM with the external drive attached. The logs also might have a record of what device this drive used in the past when connected. It will likely use the same device every time.
    If not, you can guess. I have seen one of my external disks mount using the device disk1s2. If I were to attach that to my machine in SUM, I could then mount it like this:
    mount_hfs /dev/disk1s2 /Volumes/recover
    where the mount point /Volumes/recover is something I created (i.e. just a simple "mkdir /Volumes/recover"). This could be anything you want.

  • Pcmanfm is "Not Authorized" to mount usb drives

    Hi,
    I recently installed arch linux it's a nice distro but I got a few problem with it.
    The biggest one is that I am actually not able to mount usb drives with pcmanfm this means that I am not able to use my old debian /home so far.
    I tired multiple thinks (some of them are still active)  e.g for example I used to setup a udev rules which wasn't helpful at all (and even after deleting this rule I always see server empty folder in /media (but that's another problem)).
    Any ideas why I am not able to mount encrypted and not encrypted USB drives in arch linux?
    Last edited by 42sec (2011-12-28 13:21:41)

    wonder wrote:paste ck-list-sessions output, uname -r and cat /etc/pam.d/login
    [sec42@archlinux ~]$ ck-list-sessions
    Session1:
    unix-user = '1000'
    realname = ''
    seat = 'Seat1'
    session-type = ''
    active = FALSE
    x11-display = ''
    x11-display-device = ''
    display-device = '/dev/tty1'
    remote-host-name = ''
    is-local = TRUE
    on-since = '2011-12-28T14:28:01.840505Z'
    login-session-id = '1'
    idle-since-hint = '2011-12-28T14:28:32.462384Z'
    [sec42@archlinux ~]$ uname -r
    3.1.5-1-ARCH
    [sec42@archlinux ~]$ cat /etc/pam.d/login
    #%PAM-1.0
    auth required pam_securetty.so
    auth requisite pam_nologin.so
    auth required pam_unix.so nullok
    auth required pam_tally.so onerr=succeed file=/var/log/faillog
    # use this to lockout accounts for 10 minutes after 3 failed attempts
    #auth required pam_tally.so deny=2 unlock_time=600 onerr=succeed file=/var/log/faillog
    account required pam_access.so
    account required pam_time.so
    account required pam_unix.so
    #password required pam_cracklib.so difok=2 minlen=8 dcredit=2 ocredit=2 retry=3
    #password required pam_unix.so sha512 shadow use_authtok
    session required pam_unix.so
    session required pam_env.so
    session required pam_motd.so
    session required pam_limits.so
    session optional pam_mail.so dir=/var/spool/mail standard
    session optional pam_lastlog.so
    session optional pam_loginuid.so
    -session optional pam_ck_connector.so nox11
    -session optional pam_systemd.so

  • HAL doesn't let regular users browse NTFS drives

    If I plug a USB hard drive into my computer that is using an NTFS filesystem, I get a dialog box saying "Failed to open directory "disk-1".  Permission denied."  Most of the time with flash drives and the like, I plug it in and it just works (wowee!).  But in this case, it's getting its unix on.  I haven't messed with the fstab if that's what I have to dink with.  What can I do to allow a regular user read and write to NTFS drives via HAL?

    I use both the policy rule and the mount.ntfs-3g workaround, as I have many files with greek characters on my removable NTFS volumes- and without the workaround they are invisible (despite the fact that the system default is el_GR.UTF8).
    I didn't need to apply the "ln -s /sbin/mount.ntfs-3g /sbin/mount.ntfs" workaround, as I had no issues (using a fairly standard kernel26).

  • [SOLVED]Mounting usb drives "not authorized" with thunar-volman (XFCE)

    Hi,
    I'm new to Arch (even though I must be approximately at my 15th try at installing it properly) and I have a problem with thunar-volman.
    Whenever I log in as user, and try to mount a usb drive with thunar, let's say I want to plug a drive labeled Ext3_8Go, I get the same message in a pop-up window : "Failed to mount Ext3_8Go (or anything close, not in English in the text), not authorized (that part is in English)"
    My install is :
    - net install
    - partitions : 9Go for /, no swap, no separate /home
    - packages : base and base-devel. The only modifications in the package list is that I remove ppp, pcmciautils, and xfsprogs.
    - config : at the install stage I only modify rc.conf to change LOCALE and HOSTNAME, and pacman's mirrorlist to allow all French mirrors in addition to the one at the top.
    When the usb installation is over, I run this script :
    "installation_xfce.sh"  (there may be some errors left, I modify this script as I learn) :
    #!/bin/bash
    # expected environment : freshly installed archlinux, login : root.
    echo "Are you connected to internet ? If not, please Ctrl+C and reload this script when connected"
    echo "Otherwise, press ENTER to continue installation"
    read var_dummy
    echo "Creation of the user : please type in your user name :"
    read var_username
    useradd -u 1000 -g users -G audio,lp,storage,optical,video,wheel,games,power,network -d /home/$var_username/ -s /bin/bash -m $var_username
    echo "You will now be asked to create the password for this user:"
    passwd $var_username
    # Add servers for pacman to find packages
    cat >> /etc/pacman.conf << EOF
    [multilib]
    Include = /etc/pacman.d/mirrorlist
    [archlinuxfr]
    Server = http://repo.archlinux.fr/\$arch
    [catalyst]
    Server = http://catalyst.apocalypsus.net/repo/catalyst/\$arch
    EOF
    # Install packages
    pacman -Syyu
    pacman -S acpi acpid alsa-oss alsa-plugins alsa-utils catalyst catalyst-utils cpufrequtils cups dbus gstreamer0.10-base-plugins iptables laptop-mode-tools mesa net-tools netcfg ntp pm-utils rfkill rsync sudo ttf-dejavu vim wireless_tools xf86-input-evdev xorg-server xorg-utils xorg-xinit xorg-xinput yaourt conky gamin gnome-icon-theme gnome-keyring gvfs-afc network-manager-applet networkmanager slim slim-themes archlinux-themes-slim hicolor-icon-theme xfce4 xfce4-goodies
    # If pacman failed, better stop the script here, and wait for a network connection
    if [[ $?!=0 ]]
    then
    echo : failed to install packages - check your network connection, or review script
    exit 1
    fi
    # Fix sound issue
    cat > /home/$var_username/.asoundrc << EOF
    pcm.!default{
    type hw
    card 1
    device 0
    ctl.!default{
    type hw
    card 1
    device 0
    EOF
    chown $var_username:users /home/$var_username/.asoundrc
    # Configure video settings for X to use Catalyst
    if [[ ! -e /etc/X11/xorg.conf.d ]]
    then
    mkdir /etc/X11/xorg.conf.d
    fi
    cat > /etc/X11/xorg.conf.d/20-fglrx.conf << EOF
    Section "Monitor"
    Identifier "aticonfig-Monitor[0]-0"
    Option "VendorName" "ATI Proprietary Driver"
    Option "ModelName" "Generic Autodetecting Monitor"
    Option "DPMS" "true"
    EndSection
    Section "Device"
    Identifier "aticonfig-Device[0]-0"
    Driver "fglrx"
    EndSection
    EOF
    sed -e 's/top_left/bottom_right/' -e '/alignment/i\double_buffer yes' -e '/CPU Usage/a\${color lightgrey}Temperatures:' -e '/CPU Usage/a\ CPU:$color ${hwmon 0 temp 1}°C' </etc/conky/conky.conf >/home/$var_username/.conkyrc
    chown $var_username:users /home/$var_username/.conkyrc
    # Install clickpad support
    yaourt -S xf86-input-synaptics-clickpad
    # Add french keyboard to X
    sed '/MatchIsKeyboard/a\\tOption "XkbLayout" "fr"' </etc/X11/xorg.conf.d/10-evdev.conf >/etc/X11/xorg.conf.d/10-evdev.conf.new
    mv -f /etc/X11/xorg.conf.d/10-evdev.conf.new /etc/X11/xorg.conf.d/10-evdev.conf
    # Add new daemons, remove old ones, disable hwclock and remove netfs since I don't use it. add it if you need it
    sed '/DAEMONS=/c\DAEMONS=(!hwclock dbus syslog-ng networkmanager laptop-mode acpid @alsa @cupsd @cpufrequtils ntpd crond)' </etc/rc.conf >/etc/rc.conf.new
    mv -f /etc/rc.conf.new /etc/rc.conf
    # Slim login manager ; change theme
    mv /usr/share/slim/themes/archlinux-darch-grey /tmp/
    mv /usr/share/slim/themes/default /tmp/
    rm -r /usr/share/slim/themes/*
    mv /tmp/archlinux-darch-grey /usr/share/slim/themes
    mv /tmp/default /usr/share/slim/themes
    sed '/^current_theme/c\current_theme archlinux-darch-grey' </etc/slim.conf >/etc/slim.conf
    # XFCE login, and thunar launched as a daemon
    sed '/^# exec/c\' </etc/skel/.xinitrc >/tmp/.xinitrc
    sed '/^# .../c\' </tmp/.xinitrc >/home/$var_username/.xinitrc
    cat >> /home/$var_username/.xinitrc << EOF
    exec ck-launch-session startxfce4
    thunar --daemon &
    EOF
    chown $var_username:users /home/$var_username/.xinitrc
    # Boot to runlevel 5 now, and run slim then
    sed -e 's/id:3/#id:3/' -e 's/#id:5/id:5/' -e 's|x:5:respawn:/usr/bin/xdm|#x:5:respawn:/usr/bin/xdm|' -e 's|#x:5:respawn:/usr/bin/slim|x:5:respawn:/usr/bin/slim|' </etc/inittab >/etc/inittab.new
    mv -f /etc/inittab.new /etc/inittab
    # Add colored prompt to user and root
    sed '/^PS1/c\' </etc/skel/.bashrc >/root/.bashrc
    cat >> /root/.bashrc << EOF
    PS1='\[\e[0;32m\]\u@\h\[\e[m\] \[\e[0;35m\]\w\[\e[m\] \[\e[m\] \[\e[0;32m\]\t -\[\e[m\] \[\e[1;31m\]\$ \[\e[m\] '
    EOF
    cp /root/.bashrc /home/$var_username/.bashrc
    chown $var_username:users /home/$var_username/.bashrc
    # How does one do that automatically ?
    # Manually add user to sudoers
    EDITOR="vim" visudo
    # Reboot, because it's quick and I'm too lazy to learn how to start all the daemons and others.
    reboot
    I can mount as a user, no password asked, with :
    udisks --mount /dev/sdb2
    but the GUI method tells me "not authorized".
    "groups user" outputs :
    lp wheel games network video audio optical storage power users
    the command "ck-list-sessions" outputs :
    Session2:
    unix-user = '1000'
    realname = ''
    seat = 'Seat1'
    session-type = ''
    active = TRUE
    x11-display = ':0.0'
    x11-display-device = '/dev/tty7'
    display-device = ''
    remote-host-name = ''
    is-local = TRUE
    on-since = '2011-08-15T08:56:03.716103Z'
    login-session-id = '1'
    Session1:
    unix-user = '1000'
    realname = ''
    seat = 'Seat2'
    session-type = ''
    active = FALSE
    x11-display = ':0.0'
    x11-display-device = ''
    display-device = ''
    remote-host-name = ''
    is-local = TRUE
    on-since = '2011-08-15T08:56:03.573029Z'
    login-session-id = '1'
    For those who don't have time to read the installation script, DBUS is in the DAEMONS list of rc.conf, and .xinitrc launches : exec ck-launch-session startxfce4
    Any idea ?
    Last edited by choubbi (2011-08-15 15:05:04)

    Thanks a lot !
    That worked !
    I stumbled across this part of the wiki several times before, but didn't really understand so I had not tried.
    If anyone's interested in the script, here's the corrected version :
    #!/bin/bash
    # expected environment : freshly installed archlinux, login : root.
    echo "Are you connected to internet ? If not, please Ctrl+C and reload this script when connected"
    echo "Otherwise, press ENTER to continue installation"
    read var_dummy
    echo "Creation of the user : please type in your user name :"
    read var_username
    useradd -u 1000 -g users -G audio,lp,storage,optical,video,wheel,games,power,network -d /home/$var_username/ -s /bin/bash -m $var_username
    echo "You will now be asked to create the password for this user:"
    passwd $var_username
    # Add servers for pacman to find packages
    cat >> /etc/pacman.conf << EOF
    [multilib]
    Include = /etc/pacman.d/mirrorlist
    [archlinuxfr]
    Server = http://repo.archlinux.fr/\$arch
    [catalyst]
    Server = http://catalyst.apocalypsus.net/repo/catalyst/\$arch
    EOF
    # Install packages
    pacman -Syyu
    pacman -S acpi acpid alsa-oss alsa-plugins alsa-utils catalyst catalyst-utils cpufrequtils cups dbus gstreamer0.10-base-plugins iptables laptop-mode-tools mesa net-tools netcfg ntp pm-utils rfkill rsync sudo ttf-dejavu vim wireless_tools xf86-input-evdev xorg-server xorg-utils xorg-xinit xorg-xinput yaourt conky gamin gnome-icon-theme gnome-keyring gvfs-afc network-manager-applet networkmanager slim slim-themes archlinux-themes-slim hicolor-icon-theme xfce4 xfce4-goodies
    # If pacman failed, better stop the script here, and wait for a network connection
    if [[ $?!=0 ]]
    then
    echo : failed to install packages - check your network connection, or review script
    exit 1
    fi
    # Fix sound issue
    cat > /home/$var_username/.asoundrc << EOF
    pcm.!default{
    type hw
    card 1
    device 0
    ctl.!default{
    type hw
    card 1
    device 0
    EOF
    chown $var_username:users /home/$var_username/.asoundrc
    # Configure video settings for X to use Catalyst
    if [[ ! -e /etc/X11/xorg.conf.d ]]
    then
    mkdir /etc/X11/xorg.conf.d
    fi
    cat > /etc/X11/xorg.conf.d/20-fglrx.conf << EOF
    Section "Monitor"
    Identifier "aticonfig-Monitor[0]-0"
    Option "VendorName" "ATI Proprietary Driver"
    Option "ModelName" "Generic Autodetecting Monitor"
    Option "DPMS" "true"
    EndSection
    Section "Device"
    Identifier "aticonfig-Device[0]-0"
    Driver "fglrx"
    EndSection
    EOF
    sed -e 's/top_left/bottom_right/' -e '/alignment/i\double_buffer yes' -e '/CPU Usage/a\${color lightgrey}Temperatures:' -e '/CPU Usage/a\ CPU:$color ${hwmon 0 temp 1}°C' </etc/conky/conky.conf >/home/$var_username/.conkyrc
    chown $var_username:users /home/$var_username/.conkyrc
    # Install clickpad support
    yaourt -S xf86-input-synaptics-clickpad
    # Add french keyboard to X
    sed '/MatchIsKeyboard/a\\tOption "XkbLayout" "fr"' </etc/X11/xorg.conf.d/10-evdev.conf >/etc/X11/xorg.conf.d/10-evdev.conf.new
    mv -f /etc/X11/xorg.conf.d/10-evdev.conf.new /etc/X11/xorg.conf.d/10-evdev.conf
    # Add new daemons, remove old ones, disable hwclock and remove netfs since I don't use it. add it if you need it
    sed '/DAEMONS=/c\DAEMONS=(!hwclock dbus syslog-ng networkmanager laptop-mode acpid @alsa @cupsd @cpufrequtils ntpd crond)' </etc/rc.conf >/etc/rc.conf.new
    mv -f /etc/rc.conf.new /etc/rc.conf
    # Slim login manager ; change theme
    mv /usr/share/slim/themes/archlinux-darch-grey /tmp/
    mv /usr/share/slim/themes/default /tmp/
    rm -r /usr/share/slim/themes/*
    mv /tmp/archlinux-darch-grey /usr/share/slim/themes
    mv /tmp/default /usr/share/slim/themes
    sed '/^current_theme/c\current_theme archlinux-darch-grey' </etc/slim.conf >/etc/slim.conf
    # XFCE login, and thunar launched as a daemon (note that the part with 'if [ -d /etc/X11/xinit/xinitrc.d ]" is not present, to avoid mounting problems when logged as regular user)
    cat > /home/$var_username/.xinitrc << EOF
    #!/bin/sh
    # ~/.xinitrc
    # Executed by startx (run your window manager from here)
    exec ck-launch-session startxfce4
    thunar --daemon &
    EOF
    chown $var_username:users /home/$var_username/.xinitrc
    # Boot to runlevel 5 now, and run slim then
    sed -e 's/id:3/#id:3/' -e 's/#id:5/id:5/' -e 's|x:5:respawn:/usr/bin/xdm|#x:5:respawn:/usr/bin/xdm|' -e 's|#x:5:respawn:/usr/bin/slim|x:5:respawn:/usr/bin/slim|' </etc/inittab >/etc/inittab.new
    mv -f /etc/inittab.new /etc/inittab
    # Add colored prompt to user and root
    sed '/^PS1/c\' </etc/skel/.bashrc >/root/.bashrc
    cat >> /root/.bashrc << EOF
    PS1='\[\e[0;32m\]\u@\h\[\e[m\] \[\e[0;35m\]\w\[\e[m\] \[\e[m\] \[\e[0;32m\]\t -\[\e[m\] \[\e[1;31m\]\$ \[\e[m\] '
    EOF
    cp /root/.bashrc /home/$var_username/.bashrc
    chown $var_username:users /home/$var_username/.bashrc
    # How does one do that automatically ?
    # Manually add user to sudoers
    EDITOR="vim" visudo
    # Reboot, because it's quick and I'm too lazy to learn how to start all the daemons and others.
    reboot
    The important part of the script to solve the problem is :
    cat > /home/$var_username/.xinitrc << EOF
    #!/bin/sh
    # ~/.xinitrc
    # Executed by startx (run your window manager from here)
    exec ck-launch-session startxfce4
    thunar --daemon &
    EOF
    chown $var_username:users /home/$var_username/.xinitrc

  • [SOLVED] How to automatically mount USB drives with custom mount point

    edit:
    Original title was : 'Unable to mount USB disk via /etc/rc.local', but got changed since the /etc/rc.local problem isn't relevant for me anymore.
    Hello,
    Since I am new to this forum, I'll start off with this :
    Thanks to archlinux, its founder and all its contributors, cause this is the operating system (flavour) that annoys me the least.
    The root problem :
    I want to automount USB storage devices to other places than /media/ and without the need for programs that depend on gnome and the like. As I tried some stuff with hald and such, I didn't really get to a nice and easy to configure solution. Any hints in that direction are always welcome.
    For now, automount of known USB storages devices during boot, will do.
    So the things I tried and didnt work :
    1.
    Provide the disk info to /etc/fstab (via the disks UUID and 'auto' filesystem)
    Add 'mount /mountpoint' to /etc/rc.local
    Result : the mount command in rc.local says '... specify filesystem'
    However, after boot, running /etc/rc.local mounts the USB disks correctly.
    2.
    Provide the disk info to /etc/fstab (via the disks UUID and the correct filesystem)
    Add 'mount /mountpoint' to /etc/rc.local
    Result : pc doesn't get through boot process and gives me the 'ctrl-d to reboot or root passwd for maintenance'
    3.
    Provide no disk info in /etc/fstab
    Add the full mount line to /etc/rc.local (mount -t fs /dev/disks/by-uuid/MyUUID /MyMountpoint )
    Result : don't remember the output of the mount execution, but well, it didn't mount
    However, after boot, running /etc/rc.local mounts the USB disks correctly.
    Is there something that isn't loaded at the time of rc.local execution that I need for mounting of USB devices ? Or why else is this failing ?
    Regards,
    BasiK
    Last edited by BasiK (2009-08-28 07:22:50)

    Thanks for the hint hunterthomson, but the pc I will be using it on, is an own-built HTPC/home file server, so there is no way I want to use a graphical file manager to get the usb disks mounted.
    I tried to figure out a little about udev rules, and I got to do what I wanted to do, so thx for pointing me in that direction Mr.Elendig.
    Btw, I am indeed also using auto-sleep/park disks, but this udev way works perfectly.
    I added two rules files to /etc/udev/rules.d/ :
    The first for a known usb disk (with its volume uuid), with a named mountpoint under my media dir /symbiosis/ :
    [basik@plox ~]$ cat /etc/udev/rules.d/80-usb-utopia.rules
    ACTION=="add", KERNEL=="sd[b-z][0-9]", ENV{ID_FS_UUID}=="a59332c2-07ba-4c52-afb5-20e361bdf71a",SYMLINK+="usb-%n", GROUP="storage", NAME="%k"
    ACTION=="add", KERNEL=="sd[b-z][0-9]", ENV{ID_FS_UUID}=="a59332c2-07ba-4c52-afb5-20e361bdf71a",RUN+="/bin/mkdir -p /symbiosis/utopia"
    ACTION=="add", KERNEL=="sd[b-z][0-9]", ENV{ID_FS_UUID}=="a59332c2-07ba-4c52-afb5-20e361bdf71a", RUN+="/bin/mount -t auto -o rw,noauto,sync,dirsync,noexec,nodev,noatime /dev/%k /symbiosis/utopia", OPTIONS="last_rule"
    ACTION=="remove", KERNEL=="sd[b-z][0-9]", ENV{ID_FS_UUID}=="a59332c2-07ba-4c52-afb5-20e361bdf71a", RUN+="/bin/umount -l /symbiosis/utopia", OPTIONS="last_rule"
    The second for unknown usb disks, to mount under the same dir. This is simply taken from the archwiki http://wiki.archlinux.org/index.php/Ude … .26_Tricks
    Make sure these rules are executed after the ones for specific usb disks.
    [basik@plox ~]$ cat /etc/udev/rules.d/usb-disks.rules
    KERNEL=="sd[a-z]", NAME="%k", SYMLINK+="usb%m", GROUP="storage", OPTIONS="last_rule"
    ACTION=="add", KERNEL=="sd[a-z][0-9]", SYMLINK+="usb%n", GROUP="storage", NAME="%k"
    ACTION=="add", KERNEL=="sd[a-z][0-9]", RUN+="/bin/mkdir -p /symbiosis/usb%n"
    ACTION=="add", KERNEL=="sd[a-z][0-9]", RUN+="/bin/mount -t auto -o rw,noauto,sync,dirsync,noexec,nodev,noatime /dev/%k /symbiosis/usb%n", OPTIONS="last_rule"
    ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN+="/bin/umount -l /symbiosis/usb%n"
    ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN+="/bin/rmdir /symbiosis/usb%n", OPTIONS="last_rule"
    These may not be the nicest looking udev rules, but it works for what I wanted to do with it.

  • EXTERNAL USB Drive will not open with Snow Leopard

    External USB drive will open with SL. The drive icon appears on the desktop. When I click on it, Error message, "The alias USB Drive can't be opened because the original item can't be found." When I click on "Fix Alias", a window pops up and shows the usb drive in a list but does not respond when I click on it. I then tried disk utility and tested the disk and it tested OK. The drive still will not open. This problem started after I installed Snow Leopard. Need Help.
    Message was edited by: PHAT ROB

    The same error is produced when I try to mount a smb share.
    I select the "connect to server" (cmd-K). Input the share info "smb://<user>@<server>/<share_path>
    At the auth prompt, I input my credentials.
    The error pops up, same as original poster.

  • How to mount usb drives in osx maverick?

    Tried to connect external usb drive and got thel following message:
    NTFS-3G could not mount /dev/rdisk5s1
    at /Volumes/FreeAgent Drive because the following problem occurred:
    /Library/Filesystems/fusefs.kext faailed to load - (libkern/kext) link error, check the system/kernel logs fir errors or try kextutil(8). the MacFUSE file system is not available (71)

    Other t han Paragon NTFS for OS X which has been supported and works fine the others have had trouble since 10.7.3 era.
    I use both Paragon NTFS and also their HFS+ for Windows. The demo is fully functional for 10 days and is under  $20 (may be on sale too).
    The software that some drive cases come with are often the source of trouble and best not  to install, and to reformat the drive as well.
    I believe Paragon has a utility to convert a drive to/from NTFS and HFS but check their site.
    www.paragon-software.com

  • Mounting external drives in single-user mode?

    Sigh. What were the odds of the HD on my month-old MacBook Pro and the HD on my somewhat older one (which was filling in for the moment as a backup) failing on the same night? Pretty low, I'm guessing, but that's what has happened. The Genius Bar has confirmed that the new drive is completely toast, and Apple is replacing it now, but of course they can't salvage the data. As for the old drive, while it won't boot and isn't visible to other machines in target disk mode, I am able to mount it in single-user mode and even view text files. What I can't seem to do is mount my external FireWire/USB2 drive so that I can try actually copying the files off.
    I've re-read the man page for "mount" in hopes of discovering the correct incantation, but so far it has eluded me. I've been trying things like "/sbin/mount -w /dev/disk1 /Volumes" and "/sbin/mount -w /dev/disk1 /Volumes/rescue", which return "Permission denied" and "No such file or directory" respectively...not sure that's the right device, but finding an acceptable mount point seems to be an issue regardless. Hoping someone can point me in the right direction, and thanks for reading.

    Thanks, macbig...no joy yet, but definitely a helpful link.
    I've confirmed via System Profiler on laptop #3 that my external USB drive is formatted as MS-DOS FAT32, so mount_msdos seems like the right utility to use. (The drive shows up there as /dev/disk1s1.) Meanwhile, "ls /dev/disk*" on the problem machine returns the following:
    /dev/disk0 /dev/disk0s1 /dev/disk0s2 /dev/disk1 /dev/disk1s1 /dev/disk1s2 /dev/disk1s3 /dev/disk2 /dev/disk2s1
    I've created /Volumes/rescue as a mount point and tried most of those devices with "/sbin/mount_msdos [device] /Volumes/rescue", with the following results:
    /dev/disk1:
    mount_msdos: Unsupported sector size (0)
    /dev/disk1s1:
    mount_msdos: Unsupported sector size (1)
    /dev/disk1s2:
    mount_msdos: /dev/disk1s2: Bad file descriptor
    /dev/disk1s3:
    mount_msdos: Unsupported sector size (0)
    /dev/disk2:
    mount_msdos: Unsupported sector size (64543)
    /dev/disk2s1:
    kextload: cannot resolve dependencies for kernel extension /System/Library/Extensions/msdosfs.kext
    error loading extension /System/Library/Extensions/msdosfs.kext
    mount_msdos: msdos filesystem is not available
    Based on this, I'm guessing that disk2s1 is the device I want. Unfortunately, when I try to poke around in /System/Library/Extensions, I'm getting I/O errors...gah. I have a bad feeling about this.

  • Mount USB Device in Single User Mode

    Hi All,
    Can anyone give me any assistance of mounting a USB stick in single user mode?
    I am trying to use the command:
    $ mount -uw /dev/disk2s1 /Volumes/usb
    But it get the error:
    --specified device does not match mounted device
    If I put the USB stick in normal OSX mode, then run 'df -k' in terminal, it is mounted by automounter, but I can't seem to get it to mount in single user mode.
    Thanks,
    Nik

    Hi Nik,
       I don't believe that there are enough services started in Single User Mode to do this; you'll have to start the services yourself. However, I haven't tested this so I don't know. Wanna be a Guinea Pig?
       If your going to need to write to the boot drive, mount it read/write with:
    /sbin/mount -uw /
    Next, start the basic services, including diskarbitrationd:
    /usr/libexec/registermach_bootstrapservers /etc/mach_init.d
    The above should be one line, modulo wrapping. Then start diskarbitrationd:
    /sbin/SystemStarter start Disks
    You should probably check /dev and see what disks are already mounted. (without the USB stick) I assume that the services that mount removable media are now started so insert the stick and see if it appears mounted in /Volumes. Otherwise, check /dev and see if there's a new disk. If it only appears in /dev, you can use the standard mount command to mount it. If it doesn't appear in /dev then you might reboot into Single User Mode and repeat the procedure with the USB stick already inserted. If none of that works then this must not be the right method and you have my apologies.
    Gary
    ~~~~
       Computers are like air conditioners. Both stop working
       if you open windows.
          -- Adam Heath

  • Stop USB Drive unmounting at User Logoff

    When my users logoff, the external USB drive is unmounted. The external drive is used to hold the users home directory. I have placed an entry in fstab as:
    +*/dev/disk1s6 /Mount/LaCie hfs noowners 0 2*+
    The mount works with +*mount -a*+
    I got the system to stop from unmounting the drive at login with the command
    +*defaults write /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisksWithoutUserLogin -bool YES*+
    which I found in another post.
    At this point I have to issue a mount after as user logs off, which is pretty rare at my house, fortunately.
    How can I change my systems behavior to leave the /Mount/LaCie drive mounted when the users log on or off?

    Teresa Meerschaert wrote:
    +*defaults write /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisksWithoutUserLogin -bool YES*+
    That command should keep disks mounted no matter who logs in or out. Isn't it working for you? Did you reboot after entering the command?

  • [SOLVED] Thunar (XFCE4) Does not Auto-mount USB Drive

    After reading some posts related to USB auto-mounting in Thunar and yet still having the problem, I decided to post this. Thunar used to detect the USB drives and auto-mount them. These days (I GUESS after moving to systemd), It cannot do so. Still, there is the icon of USB drive on the left side panel, but when I click on it to browse it, I get this error:
    Failed to mount "USB_LABLE".
    Error when getting information for file
    '/media/usbhd-sdc1': Transport endpoint is not connected.
    I am still able to use "sudo mount..." and get the job done, but I would prefer the convenient way it used to work. Here are some information about my system:
    command> cat ~/.xinitrc
    if [ -d /etc/X11/xinit/xinitrc.d ]; then
    for f in /etc/X11/xinit/xinitrc.d/*; do
    [ -x "$f" ] && . "$f"
    done
    unset f
    fi
    exec startxfce4
    command> loginctl show-session $XDG_SESSION_ID
    Id=1
    Timestamp=Sat, 2012-11-10 20:35:51 CET
    TimestampMonotonic=34276379
    DefaultControlGroup=name=systemd:/user/username/1
    VTNr=7
    Display=:0.0
    Remote=no
    RemoteUser=root
    Service=slim
    Leader=297
    Audit=1
    Type=x11
    Class=user
    Active=yes
    State=active
    KillProcesses=no
    IdleHint=no
    IdleSinceHint=0
    IdleSinceHintMonotonic=0
    command> systemctl status polkit
    polkit.service - Authorization Manager
    Loaded: loaded (/usr/lib/systemd/system/polkit.service; static)
    Active: active (running) since ...
    Docs: man:polkit(8)
    Main PID: 305 (polkitd)
    CGroup: name=systemd:/system/polkit.service
    305 /usr/lib/polkit-1/polkitd --no-debug
    command> dmesg
    Attached scsi generic sg1 type 0
    [sdc] 15470592 512-byte logical blocks: (7.92 GB/7.37 GiB)
    [sdc] Write Protect is off
    [sdc] Mode Sense: 23 00 00 00
    [sdc] No Caching mode page present
    [sdc] Assuming drive cache: write through
    [sdc] No Caching mode page present
    [sdc] Assuming drive cache: write through sdc: sdc1
    [sdc] No Caching mode page present
    [sdc] Assuming drive cache: write through
    [sdc] Attached SCSI removable disk
    I'd rather not edit the /etc/fstab; the way Thunar used to behave, was working with every new USB. I wonder if anybody can shed some lights.
    Last edited by Shahab (2012-11-10 21:56:24)

    The error looks suspiciously like one I had not so long ago and it turned out I still had an 11-media-by-label-auto-mount.rule in /etc/udev/rules.d.  Once I removed that and rebooted everything was fine again.

  • Mounting USB drive over network

    Hello,
    I'm working through an issue that I don't quite understand, I think. Here's my setup.
    iBook G3 running 10.4.7
    iMac G4 running 10.4.7
    Airport Express (both computers connecting wirelessly)
    My Book external USB 250Gb Drive connected to the iMac G4
    I'm trying to access the My Book drive with the iBook using the "Connect to Server" selection on the "Go" finder menu. I type in the local IP of the iMac and it asks me how I want to connect. (Guest or Registered)
    I choose registered, and use the username and password of the admin account on the iMac. It presents me with the user folder and the hard drive volume as well as any disk images that I might have loaded (a downloaded .dmg, for instance) but the USB drive never shows up in the list of volumes to mount.
    I downloaded Share Points and added the drive to the list of shared volumes, then restarted the iMac, but it still does not come up in the list when I try connecting to the iMac from the iBook. I'm not real confident that I have Share Points set up correctly, I haven't spent enough time to wrap my head around exactly what that software is trying to do.
    Any ideas as to where I've gone wrong?
    Is there a better way to go about doing this?
    It's a hassle to switch the drive back and forth to either machine as I want to work on one or the other. All the cords limit mobility on the laptop as well.
    I should like to leave the drive connected to the iMac and use the files with either computer.

    trying checking or unchecking the "Ignore Ownership
    on this volume" box when you "get info" (file menu)
    on the firewire drive.
    I don't seem to have this option. It sounded promising, nonetheless... The Disk Utility also doesn't mention this.
    Does it matter that it's a FAT32 volume? I hadn't thought to include this initially... If it does, and it's not possible, then I can give up, as I don't have another drive to back up to and reformat the one I'd like to use. Perhaps this will result in finally getting a dreamy LaCie drive... =)

  • Single User Mode - mount external drive and copy user files to there

    I have an iBook G4 running (I think) Tiger (although it may be Panther). AHT reports a bad HD and it will not boot from that drive. Mounting it via Target Disk to another Mac won't permit me to even see beyond the root directory; just a spinning sunburst at the bottom of the Finder window.
    If I boot into single-user mode, I can "ls" and "cd" to see the files and folders in the home folder. Assuming the HD is named "Macintosh HD" and I have a USB-connected hard drive named "Backup", what are the commands I need to use in single-user mode in order to mount "Backup" and copy the user's home folder (there's only one on this drive) over to "Backup"?
    As I indicated above, I'm not absolutely sure whether this iBook is running Panther or Tiger.
    Thanks in advance for any assistance!

    I'm in the middle of copying things.
    I did a chmod -R ug+w (IIRC) to the 300GB volume and this made it writable.
    I then CD'd to the Pictures folder on the Macintosh HD.
    I then did a cp *.jpg /Volumes/300GB/ and found that it managed to copy all of the jpegs that were sitting loose in the Pictures folder. Some of the photos were corrupted but I expected this as the drive is reported to have a hardware issue by AHT.
    I'm now in the process of copying the iPhoto Library using the cp -r command. Some files are being reported as bad and can't be copied but, again, I'm expecting this.
    Whatever I can get from this drive will be a bonus. I'll mention that I used Drive Genius to duplicate the HD to a disk image and, while this was done successfully, it resulted in a "no filesystem" error when I attempted to mount it. However, I -did- ask for it to be mounted anyway and then used DiskWarrior on it (even though it didn't appear in the Finder). It took a few hours for DiskWarrior to come up with a "preview" of the disk (as the filesystem was thoroughly hosed). The User folder was nowhere to be found and every file that was displayed was corrupt. That's why I'm trying this "out of the GUI" process.
    I'll thank everyone who made suggestions; they all pointed me in the proper direction.

  • Cannot  mount USB disk in SIngle-user mode (solaris 10)

    Hi all ,
    I need some help please :
    I can read/write to my USB disks when i'm in muti-user mode but when to I swith to single-user mode ( init S ), I cannot mount it.
    in Single-user mode , i started volume management daemon :
    #/etc/init.d/volgmt start
    #volcheck
    but i'm still not able to mount it.
    I tried to mount manually:
    #mount /dev/dsk/c2t0d0p0 /testpoint , i have this error: < mount : not a UFS magic number ( 0x0) , dev/dsk/c2t0d0p0 is not of this fstype.
    My system recognizes the USB device though in single-user mode:
    This is an output of #iostat -En
    c2t0d0 Soft Errors: 1 Hard Errors: 0 Transport Errors: 0
    Vendor: BUFFALO Product: ClipDrive Revision: 2.00 Serial No:
    Size:0.07GB <65339392 bytes>
    Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
    Illegal Request: 1 Predictive Failure Analysis: 0

    Hi ,
    thanks for your advice. My problem is resolved.
    The USB drive was actually a FAT filesystem.
    so I did # mount -F pcfs /dev/dsk/c2t0d0p0:c /testpoint and everything went fine
    I can read/write to my USB disks when i'm in
    muti-user mode but when to I swith to single-user
    mode ( init S ), I cannot mount it.
    in Single-user mode , i started volume management
    daemon :
    /etc/init.d/volgmt start
    #volcheck
    but i'm still not able to mount it.It probably requires other items to be started
    first.
    I tried to mount manually:
    #mount /dev/dsk/c2t0d0p0 /testpoint , i have
    this
    error: < mount : not a UFS magic number ( 0x0) ,
    dev/dsk/c2t0d0p0 is not of this fstype.
    Looks like it's assuming UFS. If this is a pcfs
    filesystem, give it the type on the mount line.
    # mount -F pcfs /dev/dsk/c2t0d0p0 /testpointYeah, this was the right command, I had to specify option < -F pcfs >.
    but I read somethere on this forum i had to specify :c as the drive for FAT at the end of c2t0d0p0 , so the full command was:
    # mount -F pcfs /dev/dsk/c2t0d0p0:c /testpoint
    >
    DarrenThanks,
    Sakolan.

Maybe you are looking for