LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Mounting a samba Share (http://www.linuxquestions.org/questions/linux-networking-3/mounting-a-samba-share-933322/)

jeffreydavisjr 03-07-2012 08: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:
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.

mandyapenguin 03-07-2012 10:02 PM

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


jeffreydavisjr 03-08-2012 08: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 10:36 AM

Quote:

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

jeffreydavisjr 03-08-2012 11:18 AM

You da man! SOLVED!


All times are GMT -5. The time now is 02:23 PM.