You are not logged in.

#1 2009-10-16 04:09:25

DePingus
Member
From: Miami, Fl
Registered: 2008-09-07
Posts: 44

[SOLVED] sudden mount problem

Sup gurus,

I need some help. Im having a sudden problem with mount. I'm sure this happened after some update or another.

For months I've been using

sudo mount.cifs //myserver/shared /home/myuser/sharemount -o user=myuser,password=mypassword

All of a sudden I can't write to the mounted shared folder. I noticed that after I mount using sudo, the owner of '/home/myuser/sharemount' becomes 'root'. Is that normal? Could that be why 'myuser' doesn't have write permissions to it? If so, how do I prevent that from happening, or (better yet) how do I let 'myuser' mount shares without having to sudo? I don't have any entries in my fstab for this stuff because that share isn't always up, plus I use HAL.

I also have a similar problem when automounting usb drives using thunar-volman. I see the device in the left column of thunar, but thunar doesn't have permission to mount it.

I guess I really need 'myuser' to be able to mount without sudo.

Last edited by DePingus (2009-10-18 02:03:00)

Offline

#2 2009-10-16 06:26:18

kgas
Member
From: Qatar
Registered: 2008-11-08
Posts: 718

Re: [SOLVED] sudden mount problem

If you are using gnome 2.28 and the share is NTFS there is a solution here. Pl do a search, a lot has been discussed.

Offline

#3 2009-10-16 06:46:31

DarkVenger
Member
Registered: 2008-11-24
Posts: 35

Re: [SOLVED] sudden mount problem

I'm having the same problem and not understanding it too.
I've been trying to see what changed in samba or mount.cifs but haven't got a clue yet.

This has nothing to do with NTFS, because we are mount network shares using CIFS...

Offline

#4 2009-10-16 07:20:20

smurf
Member
Registered: 2005-12-08
Posts: 12

Re: [SOLVED] sudden mount problem

After an update, I do

$ sudo chmod u+s /sbin/mount.cifs
$ sudo chmod u+s /sbin/umount.cifs

and then cifs works again... I do not use Gnome, however, (XFCE4 here).

Last edited by smurf (2009-10-16 07:21:56)

Offline

#5 2009-10-16 09:48:36

DarkVenger
Member
Registered: 2008-11-24
Posts: 35

Re: [SOLVED] sudden mount problem

smurf wrote:

After an update, I do

$ sudo chmod u+s /sbin/mount.cifs
$ sudo chmod u+s /sbin/umount.cifs

and then cifs works again... I do not use Gnome, however, (XFCE4 here).

That works quite well indeed, but for some time now, to avoid doing that after every update, I gave my user permission to mount with sudo and it worked like a charm. (And I'm unsure of what represents a bigger security risc, sudo or suid...)

But now if a user mounts with sudo, the owner and group of the mount point changes to root and then the user cannot write to it although it can read.
It seems I need to revert to that "old" method...

Offline

#6 2009-10-16 12:46:47

kgas
Member
From: Qatar
Registered: 2008-11-08
Posts: 718

Re: [SOLVED] sudden mount problem

sudo mount.cifs //<ip addrss>/<share name>  /<where to mount> -o username=<name> password=<usr password>

works without problem for me.

Offline

#7 2009-10-16 21:26:24

DarkVenger
Member
Registered: 2008-11-24
Posts: 35

Re: [SOLVED] sudden mount problem

For me it still changes the owner and group of the mount point to root and then the user can write...weird.

But it works fine with setuid...

Offline

#8 2009-10-17 02:13:24

DePingus
Member
From: Miami, Fl
Registered: 2008-09-07
Posts: 44

Re: [SOLVED] sudden mount problem

smurf wrote:

After an update, I do

$ sudo chmod u+s /sbin/mount.cifs
$ sudo chmod u+s /sbin/umount.cifs

and then cifs works again... I do not use Gnome, however, (XFCE4 here).

Dude, somebody here is a genius...I'm not saying who...but you know who you are!

Thanks!!!

Last edited by DePingus (2009-10-19 06:35:36)

Offline

#9 2010-05-16 20:47:35

alphazo
Member
Registered: 2009-10-20
Posts: 163

Re: [SOLVED] sudden mount problem

I'm still out of luck with this one.

When I add a line to /etc/fstab and perform the above "sudo chmod u+s /sbin/mount.cifs" I get the following message when trying to mount the share as regular user.

This mount.cifs program has been built with the ability to run as a setuid root program disabled.
mount.cifs has not been well audited for security holes. Therefore the Samba team does not recommend installing it as a setuid root program.

Offline

#10 2010-06-28 00:35:53

DePingus
Member
From: Miami, Fl
Registered: 2008-09-07
Posts: 44

Re: [SOLVED] sudden mount problem

This happened to me last month on a new install. Apparently you can't pass the password to mount a samba share in fstab anymore because anyone who can read the fstab file can see the password.
So I have a script that says:

#!/bin/bash

if [ -d /home/username/folder/subfolder ];
then
        pcmanfm /home/username/folder
else
        terminator -x sudo mount -t cifs //server/share /home/username/folder -o user=username,password=mypassword,uid=username
        pcmanfm /home/username/folder
fi

This basically starts PCmanFM (my file manager) in the shared folder for me. The script first checks if "subfolder" exists (if it does, it means the share is already mounted). If "subfolder" does NOT exist, then it tries to mount the share.

The important line for you is:

sudo mount -t cifs //server/share /home/username/folder -o user=username,password=mypassword,uid=username

You will have to enter the sudo password everytime the share mounts.
If you don't want to ever have to enter the sudo password to mount, you need to add mount to your visudo file.
Like so:

sudo EDITOR=nano visudo

and add something like:

%wheel ALL=NOPASSWD: /sbin/mount.cifs
%wheel ALL=NOPASSWD: /bin/mount
%wheel ALL=NOPASSWD: /sbin/umount

This lets anyone in the "wheel" group sudo mount without having to supply the password.
Careful editing your sudo file...you can screw things up and open security holes.

Hope this helps!

Offline

Board footer

Powered by FluxBB