mounting samba share and finding samba ip in linux

following the samba/nfs post – earlier, what if we do not know the ip address of the samba server?

if you just have the samba server name say ri-fnp, smbclient can find it easily for you, just do

smbclient //ri-fnp/backup -U user -W MYDOMAIN

If you want to mount it, you will need to know the ip address. “findsmb” is useful


If the hostname does not appear, need to do a nmblookup, ie

nmblookup ri-fnp

This usually works. Say it resolves to, now mount it as you would in fstab

// /mnt cifs  domain=MYDOMAIN,user=xxx,password=xxx 0 0

or if you don’t require it to be persistent, just mount it once in command line

mount -t cifs -o domain=MYDOMAIN,user=xxx,password=xxx // /mnt

As a side note, you don’t need to connect to the samba server via ip. If in your samba.conf, you have

netbios name = MY-UBUNTU

under the [global] tag, you can connect via smb://MY-UBUNTU

one quick way to configure share dir for personal use is to

        comment = harley-ubuntu
        path = /home/spdev/projects
        writeable = yes
;       browseable = yes
        valid users = myuser

Author: bpeh

Bernard Peh is a great passioner of web technologies and one of the co-founder of Website Design and Reviews. He works with experienced web designers and developers everyday, developing and designing commercial websites. He specialises mainly in SEO and PHP programming.