Mounting samba shares at startup
Hi everybody!
I've been trying to achieve this for about 2 weeks now... it's driving me crazy!! I know there are a lot of posts about this, but I've read all of them :study: (REALLY!) and I still can't figure out how to solve my problem. I have 1 box with Slackware 10.1 and a XP box, I want the XP share to be mount at startup. I created a local folder in linux to mount the share at /windows Then I edited /etc/fstab, this is the line I use: //xpbox/share /windows smbfs users,rw,password='',dmask=777,fmask=777 0 0 The only problem I have is that the share doesn't get mounted at startup, because any user can mount them when they log in, just by doing: mount /windows During boot when it tries to mount them it shows some errors: Then just after *any* user logs in, if I open a console window I just do: mount /windows #--> the same line written in /etc/rc.d/rc.local :scratch: And the share mounts perfectly!!! So... I don't know what to do...:confused: Thanks in advance for the help... |
You can mount it after you login because smbmount needs to send a username and password to the Windows machine in order to mount the SMB file share. You don't have either of these when the system is booting. I've solved this problem by creating a script that will mount SMB file shares at boot time.
Code:
#!/bin/bash Code:
uncmount <smb-file-share> [rw] [<credentials-file>] The creditials file uses the format specified in the smbmount man page: Code:
username = <value> Cheers. |
Tnx for the answer!...
I used your script and it worked perfectly... ... then I started looking what was I doing wrong... and found it :P In the fstab line: //xpbox/share /windows smbfs users,rw,password='',dmask=777,fmask=777 0 0 I have to put the username... like this: //xpbox/share /windows smbfs users,rw,username='',password='',dmask=777,fmask=777 0 0 ... and Voilá!... this way I don't need a script, nor a credentials file... just by adding a line like that for each shared folder that I want mounted at startup it does the trick... But again, thank's a lot, without your help I couldn't have figured it out... ;) |
you can also use a credentials file
just make a file called "cred" or whatever username=yourusername password=yourpassword domain=yourdomain or workgroup then //servername/share /mnt/mntpoint smbfs credentials=/path/to/cred,users,dmask=0777,fmask=0777 0 0 that way you can make your "cred" file only readable by root, so not every user can see your password. Soule |
Permission issue for mounting
Hi Guys
I've been trying to sort this out myself too, by adding a mount command to rc.local. Problem is that the mount command needs to have root permissions and this doesn't seem to work. Is there something I'm missing? It's basically this that works as root when I'm logged in and have done my su: mount -t cifs //server/share -o username=me,password=blah /mnt/mountpoint But if I put it in the rc.local then the whole system gets totally messed up cos I reckon it can't run that command without being root. Surely the rc.local is executed at boot time by a root level user - or is that not the case? This should be pretty straightforward - just need to connect to this share at startup! Thanks in advance for your help. |
rc.local runs as root, I put mount commands like that on some of my systems and have no issues whatsoever. What do you mean, exactly, by 'totally messed up' ?
|
Basically it wouldn't log in - got jammed on the login screen.
|
The login screen happens AFTER rc.local runs. So if you add one mount command to rc.local, you get a login screen, but when you type in a login/password, you don't get your shell? Then if you remove it, everything works perfectly?
Or do you not get a login prompt? A mount in rc.local should work fine as long as the network is up. If it fails in rc.local, I'd expect the same command to fail on a command line after you log in as root. |
All times are GMT -5. The time now is 05:49 PM. |