-   Linux - Networking (
-   -   Mounting a samba Share (

jeffreydavisjr 03-07-2012 07:21 PM

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:

I'd like to mount this location to the local file system so I can browse to say:


mandyapenguin 03-07-2012 09:02 PM

You can mount samba shares with below commands if smbfs/cifs package is already installed. If not install those using

sudo apt-get install smbfs
yum install smbfs

Next run

note down the your uid and gid then run this command as root

#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

#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

//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.

#umount /mnt/nasbox
#mount -a
#df -h

jeffreydavisjr 03-08-2012 07:12 AM

Thanks for your reply! However when I run "yum install smbfs" centos returns a "no package available" error. I am running Centos 6.2.

mandyapenguin 03-08-2012 09:36 AM


Originally Posted by jeffreydavisjr (Post 4621747)
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( with cifs.

#yum install samba samba-common samba-client
then I ran

#mount -t cifs // /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
//    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
// /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
Then edit /etc/fstab file and append the following to the end as below

//nas01/nas_share /mnt/nasbox cifs uid=your_id,gid=your_group_id 0 0
or if it is password protected

//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

jeffreydavisjr 03-08-2012 10:18 AM

You da man! SOLVED!

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