Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Yesterday I was able to mount my smb share with the following command:

sudo mount -t cifs //XXXX/share /media/share -o user=Ben,password=XXX,workgroup=WORKGROUP,ip=XXX.XX.XX,uid=ben,gid=ben,rw

I don't know why it is not working anymore. (Maybe from system update).

I got the following error :

mount: only root can mount //XXX.XXX.XXX/share on /home/ben/share

I don't know how to fix this problem..

I've also tried to mount it with su -, and Smbclient is working.

I'm Running ArchLinux.

share|improve this question
1  
What is the output of echo "$EUID"? –  Chris Down Mar 1 '12 at 20:53
1  
@ChrisDown echo $EUID = 1000 –  Ben D Mar 1 '12 at 22:45
6  
@BenD - In which case you are not effectively running as root. (Obviously this should be run in the same environment as you are trying to mount in, so you should make sure it is the root shell that is expanding $EUID.) –  Chris Down Mar 1 '12 at 22:46
2  
Why is the path different between the error message and the mount command? One is /media/share and the other is /home/ben/share. Also, I recomment using /mnt for manual or static mounts. /media was created for the HAL/udev daemons to mount dynamically created disks like a USB drive. –  penguin359 Mar 2 '12 at 19:19
1  
As @9000 mentioned, see what verbose mode says by adding a -v to your mount command. Also check your system logs if you haven't already, and dmesg, and perhaps run an strace on the command for deeper troubleshooting. –  Banjer Mar 4 '12 at 15:38

2 Answers 2

If you don't know, what is happen, try strace:

sudo strace -f -F -o mount.strace mount -t cifs //XXXX/share /media/share -o user=Ben,password=XXX,workgroup=WORKGROUP,ip=XXX.XX.XX,uid=ben,gid=ben,rw

Then try search file mount.strace from bottom for some errors, you will obviously found reason... It is hard method, I know...

share|improve this answer

As I don't see any proper reason for your error, I would propose a slightly different syntax.

First I will create a new directory as root (to be sure root can create it) and then mount the share with slightly different options. Here are the commands (they should all succeed):

sudo mkdir /mnt/smb_share
sudo touch /mnt/smb_share/test && sudo rm -f /mnt/smb_share/test && echo "Permissions are OK"
sudo mount -t cifs //(hostname)/share /mnt/smb_share -o user=Ben,domain=(WORKGROUP)

The mount command should ask you for your Samba user Ben password. I have removed the uid and gid options just to remove some "noise". With this command you should be able to verify that you can mount the share. Of course you need to replace:

  • (hostname) by the share server hostname. If it does not work with the hostname, try again but use the IP address instead;
  • (WORKGROUP) by your workgroup or domain.

If this work. Try unmounting the share and remounting it with uid only:

sudo umount /mnt/smb_share
sudo mount -t cifs //(hostname)/share /mnt/smb_share -o user=Ben,domain=(WORKGROUP),uid=ben

If this is working, add the gid, then add the rw and then finally add the password option (step by step). So you can identify which of the options is not understood.

share|improve this answer

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.