LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 03-07-2012, 07:21 PM   #1
jeffreydavisjr
LQ Newbie
 
Registered: Aug 2006
Posts: 13

Rep: Reputation: 1
Mounting a samba Share


I am trying to mount a samba shared folder. I have a NAS box that I can access by browsing to:
Code:
smb://nas01
I'd like to mount this location to the local file system so I can browse to say:
Code:
/mnt/nasbox
Thanks.
 
Old 03-07-2012, 09:02 PM   #2
mandyapenguin
Member
 
Registered: Nov 2011
Location: India
Distribution: RedHat, Cent OS, Fedora, Debian, Ubuntu
Posts: 105

Rep: Reputation: Disabled
You can mount samba shares with below commands if smbfs/cifs package is already installed. If not install those using
Code:
sudo apt-get install smbfs
or
yum install smbfs
Next run
Code:
$id
note down the your uid and gid then run this command as root
Code:
#mount -t smbfs //nas01 /mnt/nasbox -o uid=userid,gid=groupid
if that share is not password protected then the share will be mounted with /mnt/nasbox. If there are many folders under //nas01 and if you wanted to mount only any particular folder then run
Code:
#mount -t smbfs //nas01/sharefolder /mnt/nasbox -o uid=userid,gid=groupid
This will be mounted until the sysem reboot. If you need permanent mount even after system reboot then edit /etc/fstab file and add the following in the end
Code:
//nas01/nas_share /mnt/nasbox smbfs username=username_of_nas,password=password_of_nas,uid=your_id,gid=your_group_id 0 0
save and close the file. Now ensure the auto mount.
Code:
#umount /mnt/nasbox
#mount -a
#df -h

Last edited by mandyapenguin; 03-07-2012 at 09:08 PM.
 
Old 03-08-2012, 07:12 AM   #3
jeffreydavisjr
LQ Newbie
 
Registered: Aug 2006
Posts: 13

Original Poster
Rep: Reputation: 1
Thanks for your reply! However when I run "yum install smbfs" centos returns a "no package available" error. I am running Centos 6.2.
 
1 members found this post helpful.
Old 03-08-2012, 09:36 AM   #4
mandyapenguin
Member
 
Registered: Nov 2011
Location: India
Distribution: RedHat, Cent OS, Fedora, Debian, Ubuntu
Posts: 105

Rep: Reputation: Disabled
Quote:
Originally Posted by jeffreydavisjr View Post
Thanks for your reply! However when I run "yum install smbfs" centos returns a "no package available" error. I am running Centos 6.2.
Sorry, since I don't know much about Cent O/S, I misguided you.
I just ran this below on Cent5.7 and could successfully mount samba share(192.168.0.1/Docs) with cifs.
Code:
#yum install samba samba-common samba-client
then I ran
Code:
#mount -t cifs //192.168.0.1/Docs /mnt

#df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/md1               15G  4.5G  9.1G  33% /
/dev/md0              487M   36M  426M   8% /boot
tmpfs                 328M     0  328M   0% /dev/shm
/dev/md3              1.4G   35M  1.3G   3% /backup
//192.168.0.1/Docs    541G  105G  409G  21% /mnt
Since my samba share is not password protected I added an entry as below to the /etc/fstab file for permanent mount
//192.168.0.1/Docs /mnt cifs uid=500,gid=501 0 0
The permanent mount also is working fine for me.

You make sure the host "nas01" is pinging from your cent machine, if not add that machine IP address to /etc/hosts file.
IP_address_of_server nas01.something.com nas01
Then edit /etc/fstab file and append the following to the end as below
Code:
//nas01/nas_share /mnt/nasbox cifs uid=your_id,gid=your_group_id 0 0
or if it is password protected
Code:
//nas01/nas_share /mnt/nasbox cifs username=samba_username,password=samba_user_password,uid=your_id,gid=your_group_id 0 0
save the file and run
#mount -a
#df -h
Now it should be mounted with /mnt/nasbox

Last edited by mandyapenguin; 03-08-2012 at 10:07 AM.
 
1 members found this post helpful.
Old 03-08-2012, 10:18 AM   #5
jeffreydavisjr
LQ Newbie
 
Registered: Aug 2006
Posts: 13

Original Poster
Rep: Reputation: 1
You da man! SOLVED!
 
  


Reply

Tags
samba, share


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trouble mounting Samba share from Windows Mobile 6.1 - samba weirdness cleidh_mor Linux - Server 0 09-21-2008 02:43 PM
mounting a samba share tronica Debian 7 06-21-2006 08:47 PM
mounting a samba share resnostyle Ubuntu 11 05-20-2006 08:42 AM
Mounting Samba Share linux_or_bust Linux - Software 6 02-16-2005 09:38 AM
Mounting Samba shares and Samba Share Login time112852 Linux - Software 1 09-14-2003 02:23 PM


All times are GMT -5. The time now is 09:51 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration