help please: mount -t smbfs -a fails as normal user, as root, doesn't mount anything
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i would like to be able to mount and umount all 5 of the smbfs shares (bottom 5) with one simple command, however, it's not working like i expected it to ....
homer@limbo:~$ mount -t smbfs -av
mount: only root can do that
homer@limbo:~$ sudo mount -t smbfs -av
nothing was mounted
there must be something i am missing ... can somebody please enlighten me?
also, if i want to use the verbose option for the regular mount command, where does it go?
sudo mount -v -t smbfs //Alien/D /mnt/alien/d
results in
/mnt/alien/d: invalid option -- v
This should work w/o root privileges. If it doesn't - then I didn't understand the problem well . If it does work, you can simply create the following script:
Code:
#!/bin/sh
mount //Alien/D
mount //Alien/M
mount //Blues/C
mount //Blues/Desktop
mount //Blues/IonceH
to mount each of these seperately, then put the script in ~/bin and change its permissions so it will be executable ('chmod 775 foo' is a good choice...).
k ... changed giud to gid (guess i been staring at the fstab too long .... sudo mount -av results in the same message as sudo mount -t smbfs -av
mount complains about the -v at the end of the mount command, but it will still mount the share ....
Quote:
homer@limbo:~$ sudo mount -t smbfs //Alien/D /mnt/alien/d -v
/mnt/alien/d: invalid option -- v
Password:
homer@limbo:~$ mount | grep alien
//Alien/D on /mnt/alien/d type smbfs (rw)
homer@limbo:~$
@ OR13: I tried your suggestion:
Quote:
homer@limbo:~$ mount //Alien/D
Password:
cannot mount on /mnt/alien/d: Operation not permitted
smbmnt failed: 1
I also encountered something I thought was weird:
Quote:
homer@limbo:~$ sudo mount //Alien/D
Password:
homer@limbo:~$ mount | grep Alien
//Alien/D on /mnt/alien/d type smbfs (ro)
homer@limbo:~$ sudo mount //Alien/D
Password:
homer@limbo:~$ mount | grep Alien
//Alien/D on /mnt/alien/d type smbfs (ro)
//Alien/D on /mnt/alien/d type smbfs (ro)
homer@limbo:~$ sudo umount /mnt/alien/d
homer@limbo:~$ mount | grep Alien
//Alien/D on /mnt/alien/d type smbfs (ro)
homer@limbo:~$ sudo umount /mnt/alien/d
homer@limbo:~$ mount | grep Alien
homer@limbo:~$
Is my memory just shotty, or is mount doing something weird? I remember that mount used to throw an error whenever i tried to mount something twice ... something like "'blah blah blah' is already mounted!", but now it just does it ...? any thoughts? I don't really know enough about the workings of mount/smbmnt to know what's going on here ....
p.s. i am running debian sarge kernel 2.4.27-2-386, samba version 3.0.14a-Debian if that helps anything ... don't know why i can't get 3.0.14a-3 to dl tho ...
You're right, normally mount returns an error when you try to mount something that's already mounted. This appears not to be the case with samba though. On my Ubuntu box at work, I can mount a Samba share more than once, in exactly the way you describe.
The -v option works just fine for me, when I give the command
Code:
$ sudo mount share -v
it mounts the samba share and gives verbose output.
cannot mount on /mnt/alien/d: Operation not permitted
I have to admit - this is really strange. Though, from what I see, it mounted it despite of the error message, or didn't it?
About the double-mounting, I think it's a bug in smbmnt that no-one bothered to solve... .
Good luck!
O.R.
PS: Remember that samba isn't perfect yet, it still needs work. Not only that, but Microsoft(R) tend to ruin open-source projects for fun, so they change home-network technology from time to time, making it hard for samba to work...
I have to admit - this is really strange. Though, from what I see, it mounted it despite of the error message, or didn't it?
It does not. It only mounts as root as demonstrated:
Quote:
homer@limbo:~$ mount /mnt/alien/d
Password:
cannot mount on /mnt/alien/d: Operation not permitted
smbmnt failed: 1
homer@limbo:~$ mount | grep alien
homer@limbo:~$ sudo mount /mnt/alien/d
Password:
homer@limbo:~$ mount | grep alien
//Alien/D on /mnt/alien/d type smbfs (rw)
homer@limbo:~$
This doesn't really bother me all that much (perhaps a little, not as much as the double mounting issue ) What i would like is to not have to type a similar command such as the above for each smbfs share entry in my fstab (shown at the start of the thread). According to mount's manpage, one is able to mount all the entries in their fstab with the command:
mount -a, and the type can be specified by the -t option. The crux of my inquiry concerning this thread is that this does not mount the shares as desired, as shown by the first post. Please let me know if further examples are needed.
Quote:
Originally Posted by OR13
PS: Remember that samba isn't perfect yet, it still needs work. Not only that, but Microsoft(R) tend to ruin open-source projects for fun, so they change home-network technology from time to time, making it hard for samba to work...
from various inquiries on the internet and the ircnet, many people suggest cifs as an alternative to smbfs .... what do you guys think?
probably the permissions for the /mnt/alien/d arent correct.
would you be willing to enlighten me as to what the correct permissions need to be? I thought that having the appropriate options in the fstab entry would supposely allow the appropriate (normal) user to mount ....
Maybe I am misunderstanding what you are trying to do. The mount -a command is used to mount all the shares listed in your fstab. There is no need to do a mount -t smbfs -av, you really only have to type mount -av. Assuming that sudo has been set up correctly by your administrator the command should work properly.
Do the samba shares mount automatically when the machine is rebooted?
This is what our fstab entry looks like for a samba share
rchristie3 caught the problem. For samba shares you need to include the samba username and password. They can be in a credentials file. Make sure that the credentials file is only readable by an authorized user.
I don't know if you can use the "users" option for smbfs. Check the mount manpage to be sure. For the users or user option, I think that you can only mount and umount by using the mount point as the argument. I always use sudo for manually mounting anyway.
If more than one user might access your computer, you don't want to have the password in the mount command if a "lsof", "ps" or /proc/ command might list the command line arguments. It is better to list the credentials file and to make sure that it isn't world readable.
Here's my fstab example for mounting a samba share:
## network mount
//AnotherComputer/AllDrives /media/smb/AnotherComputer/AllDrives cifs credentials=/etc/samba/cifs.passwd,workgroup=HomeWorkgroup,uid=WGUser,gid=WGUser,rw 0 0
And the file permissions on the linux machine are: $ls /etc/fstab
8 -rw-r--r-- 1 root root 2811 Apr 4 15:47 /etc/fstab
$ ls /etc/samba/
total 80
8 drwxr-xr-x 2 root root 4096 Feb 7 20:56 .
4 -r-------- 1 root root 38 Nov 28 20:58 cifs.passwd
4 -rw-r--r-- 1 root root 82 Nov 28 21:12 lmhosts
8 -rw------- 1 root root 8192 Jun 17 2006 secrets.tdb
16 -rw-r--r-- 1 root root 11980 Mar 30 13:02 smb.conf
4 -rw------- 1 root root 637 Mar 30 11:12 smbpasswd
4 -rw-r--r-- 1 root root 151 Mar 23 16:22 smbusers
However, to mount the samba shares as a non-root user would require some changes to this!
... on a related subject ...
A cool thing to do is use MS linkd.exe to create an NTFS junction (which is the same thing as an ext3 link) in a folder on you windows machine. So something like: > dir C:\AllDrives
Directory of C:\AllDrives
03/09/2007 02:36p <DIR> .
03/09/2007 02:36p <DIR> ..
01/02/2007 12:41a <JUNCTION> E
01/02/2007 12:36a <JUNCTION> F
01/02/2007 12:41a <JUNCTION> H
01/02/2007 12:41a <JUNCTION> I
03/09/2007 02:35p <JUNCTION> J
02/16/2007 01:13a <JUNCTION> K
0 File(s) 0 bytes
8 Dir(s) 33,477,443,584 bytes free
So all the drives on the Windows machine look like this on the linux mount: $ ls /media/AnotherComputer/AllDrives/
total 4
0 drwxrwxrwx 1 WGUser WGUser 0 Mar 9 13:36 .
4 drwxrwxr-x 5 WGUser WGUser 4096 Mar 5 01:55 ..
0 drwxrwxrwx 1 WGUser WGUser 0 Jan 1 23:41 E
0 drwxrwxrwx 1 WGUser WGUser 0 Jan 1 23:36 F
0 drwxrwxrwx 1 WGUser WGUser 0 Jan 1 23:41 H
0 drwxrwxrwx 1 WGUser WGUser 0 Jan 1 23:41 I
0 drwxrwxrwx 1 WGUser WGUser 0 Mar 9 13:35 J
0 drwxrwxrwx 1 WGUser WGUser 0 Feb 16 00:13 K
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.