LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-27-2006, 07:59 AM   #1
thevic
LQ Newbie
 
Registered: Jun 2006
Posts: 4

Rep: Reputation: 0
help please: mount -t smbfs -a fails as normal user, as root, doesn't mount anything


my fstab is as follows:

# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/hda1 / ext3 defaults,errors=remount-ro 0 1
/dev/hda6 /home ext3 defaults 0 2
/dev/hda5 none swap sw 0 0
/dev/hdc /media/cdrom0 iso9660 ro,user,noauto 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
/dev/hdb1 /mnt/ntfs1 auto ro,user,umask=0227,uid=homer,gid=users 0 0
/dev/hdb2 /mnt/ntfs2 auto ro,user,umask=0227,uid=homer,gid=users 0 0
//Alien/D /mnt/alien/d smbfs rw,user,noauto,uid=homer,giud=homer 0 0
//Alien/M /mnt/alien/m smbfs rw,user,noauto,uid=homer,giud=homer 0 0
//Blues/C /mnt/blues/c smbfs rw,user,noauto,uid=homer,giud=homer 0 0
//Blues/Desktop /mnt/blues/desk smbfs rw,user,noauto,uid=homer,giud=homer 0 0
//Blues/IonceH /mnt/blues/ioh smbfs rw,user,noauto,uid=homer,giud=homer 0 0

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
 
Old 06-27-2006, 08:13 AM   #2
Gethyn
Member
 
Registered: Aug 2003
Location: UK
Distribution: (X)Ubuntu 10.04/10.10, Debian 5, CentOS 5
Posts: 900

Rep: Reputation: 32
The -v or --verbose option goes at the end, according to the man page. Have you tried 'sudo mount -av'?

Also, I notice that you have put "giud=homer". Is this a typo, maybe you meant "gid=homer" as on your local mounts?
 
Old 06-27-2006, 08:33 AM   #3
OR13
Member
 
Registered: Jun 2006
Distribution: Fedora 14
Posts: 51

Rep: Reputation: 15
Try this:
Code:
mount //Alien/D
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...).

GOOD LUCK!
O.R.

Last edited by OR13; 06-27-2006 at 08:35 AM.
 
Old 06-27-2006, 03:14 PM   #4
thevic
LQ Newbie
 
Registered: Jun 2006
Posts: 4

Original Poster
Rep: Reputation: 0
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 ...

Last edited by thevic; 06-27-2006 at 04:13 PM.
 
Old 06-28-2006, 06:09 AM   #5
Gethyn
Member
 
Registered: Aug 2003
Location: UK
Distribution: (X)Ubuntu 10.04/10.10, Debian 5, CentOS 5
Posts: 900

Rep: Reputation: 32
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.
 
Old 06-29-2006, 10:04 AM   #6
OR13
Member
 
Registered: Jun 2006
Distribution: Fedora 14
Posts: 51

Rep: Reputation: 15
Quote:
Originally Posted by thevic
Code:
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...
 
Old 06-29-2006, 07:00 PM   #7
thevic
LQ Newbie
 
Registered: Jun 2006
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by OR13
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?

Last edited by thevic; 06-29-2006 at 07:03 PM.
 
Old 06-29-2006, 07:28 PM   #8
w3bd3vil
Senior Member
 
Registered: Jun 2006
Location: Hyderabad, India
Distribution: Fedora
Posts: 1,191

Rep: Reputation: 49
probably the permissions for the /mnt/alien/d arent correct.
 
Old 06-30-2006, 02:12 PM   #9
thevic
LQ Newbie
 
Registered: Jun 2006
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by w3bd3vil
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 ....
 
Old 07-14-2006, 07:25 AM   #10
rchristie3
LQ Newbie
 
Registered: Jul 2006
Posts: 2

Rep: Reputation: 0
mounting all samba shares

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

//Alien/share /mnt/alien/share smbfs auto,username=boo,credentials=/etc/.smbcredentials,uid=1000,gid=503,user 0 0

Also make sure your smb.conf file is correct.

Hope this helps
 
Old 07-14-2006, 07:45 AM   #11
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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.
 
Old 04-09-2007, 03:09 AM   #12
jtmoon
LQ Newbie
 
Registered: Jun 2006
Location: WA, USA
Distribution: Fedora Core 10
Posts: 16

Rep: Reputation: 5
Cool my smb mount example (how to)

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


-J_Tom_Moon_79

Last edited by jtmoon; 04-09-2007 at 03:10 AM.
 
  


Reply

Tags
debian, fstab, networking, smbfs



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to give not-root user ability to mount devices to any mount point??? jdupre Linux - General 8 02-04-2012 10:03 AM
Mount floppy as normal user melinda_sayang Slackware 3 01-13-2007 01:59 PM
cannot mount as normal user dave`2005 Linux - Newbie 3 03-16-2006 07:36 PM
normal user can mount? vacilus Linux - Software 1 12-22-2004 11:39 AM
normal user cannot use mount command mrosati Slackware 4 01-05-2004 02:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration