mounting samba share and finding samba ip in linux

following the samba/nfs post – https://www.azhowto.com/2009/08/07/mounting-file-systems-and-autofs-tips/ 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

findsmb

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

nmblookup ri-fnp

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

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

[projects]
        comment = harley-ubuntu
        path = /home/spdev/projects
        writeable = yes
;       browseable = yes
        valid users = myuser
Like it.? Share it:
Tags:

Comments are closed.