LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   connect to samba shares on startup (https://www.linuxquestions.org/questions/linux-software-2/connect-to-samba-shares-on-startup-651969/)

pepsimachine15 06-27-2008 12:26 AM

connect to samba shares on startup
 
i'm trying to mount my network shares on startup, however they do not connect. i have put a few lines into my /etc/rc.local file.. they look something like this:

mount -t smbfs //fileserver/1x300 /mnt/z -o username=administrator,password=password

i can copy that same line into a console, and run it as root, and everything connects the way it should. I would have put these commands into my /home/administrator/.kde/autostart, but mount does not want to work unless i'm root, and i suspected that everything in the autostart would try to start as my user.

is the rc.local file parsed before my network connection is active? the other mount commands in my rc.local file work, but they are for local drives not networked.

billymayday 06-27-2008 12:50 AM

Why don't you put it your fstab? I'll post back a sample line later.

pepsimachine15 06-27-2008 01:09 AM

i dont have it in my fstab because i like having all of my startup configurations all in one place. it makes it easier for me to make any changes. if putting it in my fstab is the only way to do it, then i can do it that way.

ive discovered another problem with the mount though. i do not have write access to the mount under my user, i only have write access as root. could this be because i am mounting the share as root? i tried to chown administrator /mnt/z as root, but i got an 'operation not permitted' message. im slapping the keyboard saying to my machine "but i'm ROOT!!!! you MUST permit it!!!"

billymayday 06-27-2008 01:24 AM

Mounting volumes should be done properly, and that means fstab or one of the automount points

You should get teh permissions of the user you pass to Samba

ps - have you tried mounting as cifs rather than smbfs?

pepsimachine15 06-27-2008 04:48 PM

I know about fstab, but what is "automount points"?

The username and password i'm passing to samba is the same username and password i use to log into Xwindows. I use the same username and password to log into all of my windows machines, and my linux desktop, so that I do not need to enter in a user/pass every time I want to connect to a share on a different machine.

I have not tried using cifs, I am not familiar with it.

billymayday 06-27-2008 05:09 PM

Read man autofs to get some automounting info

Cifs is basically a replacement for smbfs, so I assume that makes it better. Here's a sample fstab entry

//server/home /home/user/mountpoint cifs username=username_here,password="password here",_netdev,uid=username_here,gid=group_name_here 0 0

pepsimachine15 06-27-2008 05:15 PM

I'll just use fstab since i'm more familiar with that. Ive only used fstab to configure my local mounts before but it looks very similar.

I'll write a test entry for one of the mounts in my fstab and reboot and see what I get.

one more question... would my group_name_here be the same as my username_here? I dont really know what group my username "administrator" is under.

billymayday 06-27-2008 05:22 PM

You don't need to reboot

mount -a

will do it

You may not need the group, but my users can be members of more than one group, and for samba I want them to use a specific group

pepsimachine15 06-27-2008 05:27 PM

When I first made the entry into my fstab, I got a popup window in X saying something like "new medium found" or something of that nature, with two options, one being open or browse. so i clicked open/browse, and I got a permission denied message.

so I removed gid, and did a mount -a, and now this message appears:

mount error: could not find target server. TCP name fileserver/1x300 not found
No ip address specified and hostname not found

ping fileserver comes up as: unknown host: fileserver.

I didnt change anything on the fileserver, so I vnc'd to my mediacenter and pinged the fileserver, and got a reply.

pepsimachine15 06-27-2008 05:37 PM

I just tried using the fileserver IP instead of netbios name, and again got the message that says:

A new medium has been detected. What do you want to do?
Medium type: Unmounted samba (microsoft network) share

the two options are: Open in new window, and Do nothing.

This time, Open in new window worked.

However, i dragged a file from my desktop over to the window that opened, and I got a message saying:

Could not change permissions for: /mnt/z/kjl.doc

As I tried to copy the same file again to bring the message up to tell you exactly what it said, It actually copied this time.

weird.

pepsimachine15 06-27-2008 05:48 PM

Ok, I rebooted to make sure everything worked right, and it did not.

/mnt/z was empty after a reboot.

a simple mount -a fixed everything.

so the shares are still not connected automatically after a reboot.

billymayday 06-27-2008 05:57 PM

Can you post your fstab entry?

Does your firewall let samba through?

pepsimachine15 06-27-2008 06:22 PM

heres my fstab entry:

//192.168.1.10/1x300 /mnt/z cifs username=administrator,password=xxxxxx,_netdev,uid=administrator 0 0

I dont think I have any software firewalls running. There was one on my vector linux fileserver, but it is disabled, for exactly this purpose. plus, all my machines on my lan are behind a hardware firewall to the outside world.

I'm running pclinuxos2007 on my desktop, which is the one we're working on.

I didnt notice anything that looked like a firewall when I ran ps ux. is there a way to check for sure?


Thanks for your help billymayday. I'm leaving for a weekend getaway with my girlfriend as we speak, so I will be back sunday evening to continue working on this.

billymayday 06-27-2008 06:36 PM

Have a nice trip

billymayday 06-27-2008 07:03 PM

Have a read of man mount.cifs

I'd assume it would ne iptables, so ps aux | grep iptables should help


All times are GMT -5. The time now is 04:46 AM.