Jump to content

Mounting samba shares


ilia_kr
 Share

Recommended Posts

Hi there. I have some shared folders on windows computer that i use a lot. Usually I access them by nautilus, but now I want to try to mout them on my Linux PC to watch if there is some difference. I never done this before so i dont know how to do that.

 

How do i mount samba shares from a CLI?

How do i make Linux to automount them at boot?

 

Thanks.

 

P.S. I'm using FC4 now.

Edited by ilia_kr
Link to comment
Share on other sites

its been asked here many times, if you search here, there wll be lots of results.. but hey, where here to answer questions :D

 

ok, here's how Im mounting it on my box, using autofs, it uses automount, so regular users can mount thus M$ shared.

 

here's how I did it:

 

since you're using fedora...check if autofs has been already installed: as root:

 

rpm -qa | grep autofs

 

if installed then skip the next code, if not then install it

 

#installing autofs via yum
yum install autofs

 

after it has been installed, run it as a service

 

chkconfig autofs on

 

then edit /etc/auto.master and comment all inside it then append on it the ff: below..

 

/mnt/samba /etc/auto.samba -t=10

 

-t=10 refers to 10 seconds duration time that autofs will auto unmount mounted share

.

then create the directory /mnt/samba defined on the entries of /etc/auto.master file

mkdir /mnt/samba

 

now create the /etc/auto.samba file and enter the ff: below

windows -fstype=smbfs,username=user,password=microshaft ://192.168.1.1/shared_folder

what?

windows - name of the folder where the shared_folder of 192.168.1.1 will be mounted when someone access it.

 

192.168.1.1 - ip of windows with shared_folder

 

username and password - the username/password in your windows box that has access on that shared_folder

 

after all of the above, start autofs

 

/etc/init.d/autofs start

 

and everytime there's a changes on /etc/auto.master and /etc/auto.samba, issue command

 

/etc/init.d/autofs reload

 

now to check if it works

 

ls /mnt/samba/windows/

 

if it will lists the files inside that folder, then sucessfull, if not, then check log files.

note: makesure smbclient been installed already...

note: /mnt/samba/windows folder is autocreated if successful, you dont need to create it manually.

 

if all works fine, try also to browse on it using konqueror treating as ordinary folder. Or put a shortcut of it in your desktop

 

:D have fun!

Edited by aioshin
Link to comment
Share on other sites

I'll definitly will try that, but I 've heard somewhere that the same can be done by editing fstab. Could it be?

 

Well I foun this: https://mandrivausers.org/index.php?s=&...st&p=127325

 

The problem is that I don't have a password on my XP so I can't setup fstab without it. How can I ommit the username & password keys in fstab?

Link to comment
Share on other sites

actually, mounting via fstab is one option... the problem with that, if the shared folder is not available, and you tried to access it, say you put a shortcut of it on your desktop, there's a tendency that it causes the system to hang. because its been considered as static mount point, and then only root can re-mount it when unmounted.

 

while using autofs, it'll be mounted dynamically, only when a user tries to open it... and after the specified duration, when no one accessing the mount point, then it will auto unmount.

 

and mounting via fstab is common, see, just by searching, you found one... at least now, there's another option to mount...

Edited by aioshin
Link to comment
Share on other sites

... doesn't work

 

auto.master:

# $Id: auto.master,v 1.4 2005/01/04 14:36:54 raven Exp $
#
# Sample auto.master file
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#/misc  /etc/auto.misc --timeout=60
#/smb   /etc/auto.smb
#/net   /etc/auto.net
/mnt/mp3 /etc/auto.samba -t=10

 

auto.samba:

windows -fstype=smbfs ://192.168.123.103/MP3

I have no password on XP so i omitted username & password string

 

the result:

[root@linux-fc4 mp3]# /etc/init.d/autofs reload
Checking for changes to /etc/auto.master ....
Reload map /usr/sbin/automount --timeout=10 /mnt/mp3 file /etc/auto.samba
[root@linux-fc4 mp3]# ls /mnt/mp3
[root@linux-fc4 mp3]#

Edited by ilia_kr
Link to comment
Share on other sites

in your /etc/auto.samba you define

windows -fstype=smbfs ://192.168.123.103/MP3

 

by that, you should have to access that defined folder first for it to be mounted on your system, since by default, there is no any mounted remote folders yet by automounter/autofs unless a file on that folder has been accessed.

 

So what? I should have seen the 'windows' foder inside 'mp3', right? Checked in nautilus too, nothing there...

 

no, you'll not be able to see it unless you specify that particular folder

 

ls /mnt/mp3/windows

 

If no avail, try to check your logs, might be a problem behind..

.

and also, have'nt really tried to mount an XP share that does not have a password lately... so dunno if that one also might cause a problem on mounting.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...