View previous topic :: View next topic |
Author |
Message |
KraziKid Tux's lil' helper
Joined: 26 Dec 2002 Posts: 128
|
Posted: Sun Apr 13, 2003 7:55 pm Post subject: Add a SMB mount to /etc/fstab |
|
|
I am trying to add my Windows share to /etc/fstab and am running into problems. My username on my windows machine consists of my first name follwed by my last name, for example, "Krazi Kid" (no quotes). When I do a manual mount using the mount command, and put my username in quotes, it works. Now, when I try to do this in fstab, I get an error saying that the line is bad. How can I get this to work? |
|
Back to top |
|
|
splooge l33t
Joined: 30 Aug 2002 Posts: 636
|
Posted: Sun Apr 13, 2003 8:03 pm Post subject: |
|
|
Don't know if this will work for ya but maybe try using a \
eg
Krazi\ Kid |
|
Back to top |
|
|
KraziKid Tux's lil' helper
Joined: 26 Dec 2002 Posts: 128
|
Posted: Sun Apr 13, 2003 8:09 pm Post subject: |
|
|
I should have mentioned, I already tried escaping the space, it still didn't work. |
|
Back to top |
|
|
WarMachine Apprentice
Joined: 15 Jul 2002 Posts: 181
|
Posted: Sun Apr 13, 2003 8:43 pm Post subject: |
|
|
I just added a user account to my windows system to use for this, seemed a simpler solution. If you use XP and the welcome screen and you don't want the name there install tweakUI to remove it from that list. |
|
Back to top |
|
|
caffiend n00b
Joined: 26 Mar 2003 Posts: 48 Location: Oakland, CA
|
Posted: Mon Apr 14, 2003 2:47 am Post subject: |
|
|
try putting your login info into a file as such...
/etc/samba/credentials (this file should be only readable by root)
Code: | username = Krazi Kid
password = my_password |
then in /etc/fstab
Code: | //server/mountpoint /local/path smbfs credentials=/etc/samba/credentials 0 0 |
see if it will work without the quotes, if not try it with them. |
|
Back to top |
|
|
KraziKid Tux's lil' helper
Joined: 26 Dec 2002 Posts: 128
|
Posted: Mon Apr 14, 2003 4:14 am Post subject: |
|
|
Thank you. That works prefectly. |
|
Back to top |
|
|
d0wn_under Guru
Joined: 13 Mar 2003 Posts: 300 Location: Sheffield, England
|
Posted: Tue May 20, 2003 10:52 pm Post subject: mounting homes |
|
|
A couple of questions as extensions to this discussion:
1 - How do I setup the fstab so that a user can mount their own home directory (not automounting)? Obviously I can't setup a fstab line for each user specifying the mount point.
2 - the server.credentials file has been mentioned here and in other posts. I created one and put my username and password in it then made it only readable by root. The problem I then got was that ordinary users trying to do the mount got an error that they could not read the file. Changing the permission to all read allowed the users to come closer to mounting, this time getting the error:
Operation not permitted
root can do the mount fine, any other user can't. Also, if root mounts the share, he can write to it but ordinary users can't.
Here is my fstab entry:
//192.168.0.4/temp /mnt/ttemp smbfs credentials=/etc/server.credentials,noauto,rw,user,umask=000,gid=100 0 0
and my smb.conf lines:
[temp]
comment = Temp Share
path = /tmp
guest ok = yes
writable = yes
share modes = no
Anyone any ideas on either of these?
Ta
Robin |
|
Back to top |
|
|
stillman Apprentice
Joined: 07 Dec 2002 Posts: 223 Location: Vienna, Austria
|
Posted: Wed Jun 25, 2003 7:07 pm Post subject: |
|
|
a little late but here's an answer for 2.:
simply use the uid-option, e.g. uid=1000, that's all - here's my smb-line in fstab:
Code: | //192.168.0.1/tmp /home/shared smbfs credentials=/etc/samba/credentials,uid=1000,gid=100 0 0 |
that works fine(running edonkey-tempfolder with this share)
thank you for the credentials-solution - surprisingly i didn't find it when i searched forced, but found it accidentally now |
|
Back to top |
|
|
d0wn_under Guru
Joined: 13 Mar 2003 Posts: 300 Location: Sheffield, England
|
Posted: Wed Jun 25, 2003 9:22 pm Post subject: close, I think |
|
|
Still not quite there I now get:
cannot mount on /mnt/ttemp: Operation not permitted
smbmnt failed: 1
when a non-root user tries to mount it. I tried the line you gave me and also tried adding a "user" option to the list, both without success.
The directory I'm trying to mount it on is writable by the user, the directory being mounted is at least readable (probably writable as well) by the user but still no luck.
root can mount the share ok and then any other user can access it so the mount works and the stuff to allow other users access, just not other users mounting.
As an extra idea I also tried making the credentials file world readable for a while to see if it was that but it wasn't.
Any other ideas? |
|
Back to top |
|
|
PowerFactor Veteran
Joined: 30 Jan 2003 Posts: 1693 Location: out of it
|
Posted: Wed Jun 25, 2003 11:06 pm Post subject: |
|
|
I don't think you can have normal users mount samba shares without using sudo or something. Setting smbmount suid root might work but it's probably not a good idea. Smbmount doesnt seem to obey the user option in fstab. To allow each user to mount their home directory in the windows box I would use a script something like this. Code: | #!/bin/sh
mount -t smbfs -o \
credentials=${HOME}/.samba/credentials,uid=${SUDO_UID},gid=${SUDO_GID} \
//192.168.0.1/${SUDO_USER} /mnt/${SUDO_USER} |
Then setup sudo to allow the users to run that script. I haven't tried that script exactly so there may be some errors, but you can see point I think. And of course you would need to use sudo for the unmounting as well.
EDIT: (Ignore this, see edit2)Well I just tried and it doesn't look like sudo will work either. I just tried to mount a share with sudo and I get a "Access denied, SMB Connection failed" error. That's with the exact same command that just worked as root. Just a pure hardcoded command, no variables or anything like I have above. Any ideas?
EDIT2: My bad, sudo does work. It helps to spell credentials right. |
|
Back to top |
|
|
d0wn_under Guru
Joined: 13 Mar 2003 Posts: 300 Location: Sheffield, England
|
Posted: Thu Jun 26, 2003 3:45 pm Post subject: I'll try it later |
|
|
But till then, at work, as an ordinary user with no sudo I can mount any shares I want. This is on a standard debian install.
I've checked the sudoers file and there is nothing in there that would affect it. I wouldn't have thought that debian would suid something like mount but I may try it here.
I've tried asking the sysadmin and claims ignorance as to why it works, he is just happy it does.
Updates later... |
|
Back to top |
|
|
stillman Apprentice
Joined: 07 Dec 2002 Posts: 223 Location: Vienna, Austria
|
Posted: Thu Jun 26, 2003 3:46 pm Post subject: |
|
|
sorry, didn't read you'd want to mount smb as non-root... |
|
Back to top |
|
|
HolyCoitus n00b
Joined: 16 Jun 2003 Posts: 21 Location: Fort Wayne, Indiana
|
Posted: Sat Jul 05, 2003 2:02 am Post subject: |
|
|
I found this in another post when I was looking for a similar problem with mounting a share folder that had a space in it, hopefully this can help someone:
Oo.et.oO wrote: | from man fstab:
Quote: | If the name of the mount point contains spaces these can be escaped as `\040'. |
this, of course, works for the device as well (in this case the smb share)
here is my fstab:
Code: |
# <fs> <mountpoint> <type> <opts> <dump/pass>
/dev/hda1 /boot ext3 noauto,noatime 1 1
/dev/hda2 / ext3 noatime 0 0
/dev/hda3 none swap sw 0 0
proc /proc proc defaults 0 0
/dev/cdroms/cdrom0 /mnt/cdrom auto user,noauto,ro 0 0
/dev/fd0 /mnt/floppy auto user,noauto 0 0
//lex/my\040shared\040fo /mnt/lex/mp3 smbfs user,noauto 0 0
|
|
_________________ Celebrate this chance to be alive and breathing! |
|
Back to top |
|
|
d0wn_under Guru
Joined: 13 Mar 2003 Posts: 300 Location: Sheffield, England
|
Posted: Sat Jul 05, 2003 10:28 am Post subject: Got it in the end |
|
|
It is now all working, ta to everyone who suggested ideas.
|
|
Back to top |
|
|
phunni Apprentice
Joined: 05 May 2003 Posts: 217 Location: Bristol, UK
|
Posted: Wed Jul 23, 2003 2:09 pm Post subject: |
|
|
I have an interesting problem - I followed some of the steps above (namely using the credentials file) and I can now mount a samba share as a normal user - but I'm not allowed to umount it!
Any ideas on this one?
Here is my /etc/fstab:
my /etc/fstab wrote: | /dev/hda1 /boot ext3 noauto,noatime 1 1
/dev/hda3 / reiserfs noatime,notail 0 0
/dev/hda2 none swap sw 0 0
/dev/cdroms/cdrom0 /mnt/dvd iso9660 noauto,ro,user 0 0
/dev/cdroms/cdrom1 /mnt/cdrom iso9660 noauto,ro,user 0 0
/dev/fd0 /mnt/floppy vfat noauto,user 0 0
//livingstone/C$ /mnt/livingstone smbfs noauto,user,credentials=/etc/samba/credentials 0 0 |
_________________ Old School is the way forward! |
|
Back to top |
|
|
tank Tux's lil' helper
Joined: 28 Aug 2002 Posts: 116 Location: Virginia
|
Posted: Mon Aug 11, 2003 6:51 pm Post subject: Re: Got it in the end |
|
|
d0wn_under wrote: | It is now all working, ta to everyone who suggested ideas.
|
How did you get it working? I am trying to do the exact samething and running into the same problems you have.
Did you use sudo? |
|
Back to top |
|
|
Vlad Apprentice
Joined: 09 Apr 2002 Posts: 264 Location: San Diego, California
|
Posted: Tue Aug 26, 2003 10:43 pm Post subject: |
|
|
It is possible to have a user mount smb shares. Here's how.
1. Make sure you have an appropriate line in your /etc/fstab file for the share you wish to mount. This is well documented enough for me not to explain it here (not to mention it's been explained in posts above). Just a heads up: you MUST have "users" in your mount options for this to work!
2. If your mount path is going to be "/mnt/windows_share", then you *must* own it to mount it.
# chown vlad:users /mnt/windows_share
3. The program smbmnt MUST be SUID. I'm sure this is a possible security hazard, so use at your own risk.
# chmod +s /usr/sbin/smbmnt
Troubleshooting:
If you're still getting this error:
cannot mount on /mnt/windows_share: Operation not permitted
smbmnt failed: 1
Then you haven't put "users" in your mount options in the /etc/fstab file, or you haven't chown'ed the mount path to your username.
If you see:
smbmnt must be installed suid root for direct user mounts (101,101)
smbmnt failed: 1
Then you haven't chmod +s /usr/sbin/smbmnt. (101 refers to your UID).
Hope this helps sombody. I have no idea how to allow multiple users to mount the same share, so don't ask, as I have a single user system. |
|
Back to top |
|
|
d0wn_under Guru
Joined: 13 Mar 2003 Posts: 300 Location: Sheffield, England
|
Posted: Wed Aug 27, 2003 9:14 pm Post subject: Just one more on that |
|
|
What do you do with your login credentials (i.e. passwords)?
I've got mine in a file which I started off with as owned and only readable by root, the problem I had was that when I used my ordinary user, even though smbmnt was running as root it couldn't read the file so I ended up making the user own the file which on my single user system is ok but in a multi-user environment isn't ok.
The alternative, putting the username and password in fstab creates the same problem, it has to be open for reading by most users but that then reveals the passwords to all.
The way we get round it at work is to provide the username and password as parameters to mount which means each user can have their own username and password but there has to be a different way, this is the all flexible linux isn't it
Any ideas? |
|
Back to top |
|
|
Redneck n00b
Joined: 01 Nov 2002 Posts: 7 Location: Belgium
|
Posted: Fri Aug 29, 2003 10:30 pm Post subject: |
|
|
On my setup, /etc/fstab is chmodded 600 and owned by root:root and I can mount with a normal user (who gets a Permission denied when trying to 'cat /etc/fstab')
Maybe this info helps
(Althou I cannot unmount the damn share :)) |
|
Back to top |
|
|
|