How to mount smb share on ubuntu 18.04

I mounted a shared server on my local network using the GUI connect to server and the address I entered was smb://myServer/myFolder. Then i tried to add the shared folder to the /mnt directory so I can access to it through my IDE but I failed even though I tried unmount the server and use the CLI with the command

gio mount smb://myServer/myFolder**.

Anyone had this problem before?


Solution 1:

I opened the server i shared and typed ifconfig to get the ip adress. Then I typed this command to list of shares

smbclient -L //myServerIpAdress

Then to mount it I typed these 2 commands: first to create a folder under the /mnt and then to do the mount

sudo mkdir /mnt/myFolder

sudo mount -t cifs -o username=serverUserName //myServerIpAdress/sharename /mnt/myFolder/

Then enter the server's password when asked and your mount is done under /mnt/myFolder

Solution 2:

I just followed the Ubuntu wiki smb guide and it worked for me with Ubuntu 18.04.1

Specifically: I first creating the directory for the mount

sudo mkdir /media/NAS

I added the following line to my fstab

//192.168.1.209/public /media/NAS cifs guest,uid=1000,iocharset=utf8 0 0

and then ran

sudo mount -a

From then my NAS drive was mounted. I have rebooted my machine several times and confirmed that it now mounted and start up for me. For what its worth I'm using an Ethernet connection so it could be configured and up and running quicker than a wi-fi connection would be.

Solution 3:

If you have installed gvfs-bin you can run:

gvfs-mount smb://username@servername/sharename/

More about gvfs-mount on manpages

Also you can read official wiki Samba/SambaClientGuide