PDA

View Full Version : going nuts, USB mounting probs



lollysticky
11th February 2010, 03:30 PM
as I'm aware, there are hundreds of threads about this problem :rolleyes: . I've checked em all but to no avail... therefore I'll post my specific problem inhere.

What I did so far:

1) sudo mkdir /media/Extern_Disk

2) check fdisk -l
----------------------------------------------------------
Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x8650465e

Device Boot Start End Blocks Id System
/dev/sdc1 1 121601 976760001 7 HPFS/NTFS
----------------------------------------------------------

3) i'm able to mount it using this command: sudo mount /dev/sdc1 /media/Extern_Disk
If I'm not root or don't use sudo, I get a message I need to have root privileges !

4) however, I got tired of using sudo all the time, so I edited fstab and added this line:
----------------------------------------------------------
/dev/sdc1 /media/Extern_Disk/ ntfs-3g rw,noauto,user,umask=0 0 0
----------------------------------------------------------

5) now i'm able to mount it using: sudo mount /media/Extern_Disk

6) if mounted in this way, this appears in mtab:
----------------------------------------------------------
/dev/sdc1 /media/Extern_Disk fuseblk rw,noexec,nosuid,nodev,allow_other,blksize=4096 0 0
----------------------------------------------------------


Problem: I'm not able to mount it without using sudo. If I issue the command 'mount /media/Extern_Disk' I don't receive the 'you need root privileges' error anymore, but nothing happens whatsoever (if I use 'sudo mount /media/Extern_Disk/' it works fine)... From what I've read, the 'user' option in fstab should allow me, as a normal user, to mount :/

Therefore the obvious question... what am I doing wrong? All I want is to mount it without using root/sudo privileges using a plain 'mount /dir' command...

thanks in advance!

scott32746
11th February 2010, 04:07 PM
Hello,
I would mount a USB drive by it's UUID. If you add a new USB device it could change /dev/sdc1 to something else. ( reboot)

Here is an example of my USB mount I can mount as user
UUID=58d6c99b-f1a2-45d2-8a6e-8fec89a5dcf8 /mnt/backup auto noauto,user,exec 0 0

If you just want one user not all to mount they try changing user to ,uid=USER_ID,gid=USERGRP_ID,mode=700

You can look in /dev/disk/by-uuid for the UUID if you want to mount that way

lollysticky
11th February 2010, 04:13 PM
it's always at /dev/sdc1 :)
that's not the problem... I just can't mount it without being root or having to type sudo

i'll try the uid and gid thing tho, although I don't see why it'd make a difference :)

scott32746
11th February 2010, 04:15 PM
I think not sure but the user id would only let that user mount it.
if you do not care then use

auto noauto,user,exec 0 0

lollysticky
11th February 2010, 04:17 PM
I think not sure but the user id would only let that user mount it.
if you do not care then use

auto noauto,user,exec 0 0

off course, but I've been using the 'user' option all along :p
so limiting the mount option to one specific user id isn't going to help my specific problem :p

scott32746
11th February 2010, 04:19 PM
In your example you show allow_other not user
Sorry read mtab output not fstab

Try adding auto noauto,user,exec 0 0

vallimar
11th February 2010, 04:36 PM
Doesn't the manpage mention needing to be setuid-root for non-root users to be able to manually mount volumes?

lollysticky
11th February 2010, 04:38 PM
/dev/sdc1 /media/Extern_Disk/ auto noauto,user,exec 0 0

doesn't work either unless I use sudo or be root :)
I honestly don't have a clue why it shouldn't be working...

scott32746
11th February 2010, 04:41 PM
I am able to mount with what I gave you without being root/sudo

Hmm,,, what is the permission owner/group of the mount point ?

I looked in my /etc/group I do not have my user_id set with root

lollysticky
11th February 2010, 04:48 PM
I am able to mount with what I gave you without being root/sudo

Hmm,,, what is the permission owner/group of the mount point ?

I looked in my /etc/group I do not have my user_id set with root

exactly, it should work :p

as for the permissions; I created the folder like normal (sudo mkdir blabla)
[lollysticky@LOLLYSERVER media]$ ls -ld Extern_Disk/
drwxrwxrwx 1 root 8192 2010-02-05 14:57 Extern_Disk//

I even tried to change ownership of the folder to my regular user (which succeeded), but it doesn't make a difference for the mounting problem :(

scott32746
11th February 2010, 04:54 PM
I am not running SELinux , if you are try disabling it

and/or
You are missing a group
try
chown user_id:user_grp /Extern_Disk

lollysticky
11th February 2010, 05:02 PM
1) I have disabled SELinux long ago. Nothing but troubles there.
2)that's just my .bashrc aliases playing there :)

[lollysticky@LOLLYSERVER media]$ ls -ld Extern_Disk/
drwxr-xr-x 2 lollysticky root 4096 2010-02-11 15:06 Extern_Disk/

I changed the group to lollysticky just like you proposed
[lollysticky@LOLLYSERVER media]$ ls -ld Extern_Disk/
drwxr-xr-x 2 lollysticky lollysticky 4096 2010-02-11 15:06 Extern_Disk/

but to no avail... only mountable using sudo or root :p

btw, scott, just pondering... what is your filesystem on your removable media? I'm starting to think ntfs-3g has something to do with it :/

scott32746
11th February 2010, 05:15 PM
one of my USB drive is ext3, the other is W95 FAT32 (LBA)

lollysticky
11th February 2010, 05:15 PM
OK... it's now definitive, it's the driver... ntfs-3g must be causing the problem...

I have another USB drive which i inserted into my linux server
I added this to fstab:
--------------------------------
/dev/sdd1 /media/KINGSTON/ vfat noauto,user,exec 0 0
--------------------------------
which is identical to what I use on my external 1Tb drive, except for the driver

this WILL mount without using sudo/root privileges...
honestly, this stuff drives a man crazy :p

scott32746
11th February 2010, 05:16 PM
Glad you got it
Now we all know LOL

lollysticky
11th February 2010, 05:19 PM
yeah but how do I fix it
any suggestions? :p

open to anything :)


btw.. is there any way to check the errors that are displayed in Dolphin? When i tried to mount the external drive through Dolvin, it gave an error (displaying just beneath the window where the files/directories are displayed, in a red barline), but it wasn't very visible :/ Perhaps that could give me some hints as to what the exact reason might be


P.S. in 2 days, my 3 new 1tb drives arrive and the NTFS one will be reformatted, but still so normally the problem should go away if it's the ntfs-3g driver. But i'd still like to known the specifics :p

scott32746
11th February 2010, 05:32 PM
Check man pages for ntfs-3g

You could reformat the drive after a backup of it

lollysticky
11th February 2010, 06:10 PM
fixed it...

the ntfs-3g manpages displayed the fact that the 'user' and 'users' option doesn't work with their driver. The solution on the ntfs-3g FAQ was:
The root user can make an ntfs-3g binary setuid-root as shown below:
chown root $(which ntfs-3g)
chmod 4755 $(which ntfs-3g)

thanks to anyone inhere for helping me out :)
this is a great help :)

vallimar
11th February 2010, 08:28 PM
Umm.. I said to do that several posts ago.. so much for reading comprehension.

lollysticky
11th February 2010, 08:34 PM
Umm.. I said to do that several posts ago.. so much for reading comprehension.

yeah but your 1 sentence reply didn't give me much to go for :p
didn't know i had to check the ntfs-3g manpage (I was checking the mount manpage like a million times which doesn't mention that specific issue whatsoever). Once I hit that, I found my way...

anyways it's solved now so :)

vallimar
11th February 2010, 11:52 PM
yeah but your 1 sentence reply didn't give me much to go for :p
didn't know i had to check the ntfs-3g manpage (I was checking the mount manpage like a million times which doesn't mention that specific issue whatsoever). Once I hit that, I found my way...

anyways it's solved now so :)
That's fair.. I thought I had wrote more than I did.. guess my reply got shortened since I was dealing with work issues at the same time. Anyways, glad it's working and that you managed to figure it out. Nice to see people learning new things in linux that they can pass on later.

lollysticky
12th February 2010, 01:13 AM
still, much obliged :)

I make a habit of documenting every bump I hit so I can help others if needed :)

---------- Post added at 04:13 PM CST ---------- Previous post was at 02:58 PM CST ----------

edit: it worked for about an hour
and now it doesn't anymore

>_>

I'm gonna look at it some more tomorrow
It's getting a bit too much now :')

second edit: adjusted it the quick and dirty way -> added the Cmd_alias STORAGE to my nick in the sudoers file... now I don't need to type the pass for mounting options, just the sudo part ... Although it's solved again, I hate to do it this way :(

Isaac1357
12th February 2010, 08:05 AM
Disclaimer: this is not something to do on a system you are overly concerned about security on.

You could always write a little bash script that issues the command via sudo (named something appropriate, like mountusb or some such), throw it in /usr/local/bin, and modify the sudoers file to allow your user to run it without asking for a password.

Edit: Clarification - modify the sudoers file to allow you to run the mount command contained in the script without sudo asking you for a password.

sudoers entry would look something like this:

yourusername ALL = NOPASSWD: /bin/mount

or to be more secure about it

yourusername ALL = NOPASSWD: <your full specific mount command with options here>


That is off the top of my head, you may want to consult the sudoers man page.

lollysticky
12th February 2010, 05:49 PM
tried that
doesn't work :')

it works for all my usb stuff except for the ntfs one... so I'll just assume the driver is flawed, reformat the disk and that's that :p