Score:0

How to use smb to mount a directory of an ubuntu server on an ubuntu guest machine?

vn flag

I have setup a shared samba folder on an ubuntu 20.04 server. The below code is in the /etc/samba/smb.conf file:

[tidy-mine]
path = /media/tidy/mine
valid users = tidy
read only = no
E45: 'readonly'

I want to mount the above shared folder on the /home/guest/f_folder directory of a guest machine that runs ubuntu 20.04. The local ip address of the server is 192.168.1.10. What commands should I use?

Score:3
cn flag

Install cifs with

sudo apt-get install cifs-utils

Create the mountpoint.

sudo mkdir /home/guest/f_folder

and mount it ...

sudo mount -t cifs //192.168.1.10//media/tidy/mine /home/guest/f_folder
  • Please use dedicated mount points for both directories.

    • /media is for removable storage. Not the best place to set up a samba mount and it will break your setup when you remove the medium.
    • use /home/guest/f_folderif you really want to but I would advice against it. It is so easy to mess up when you use /home`.
Admia avatar
vn flag
I received the error `Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)`
Score:2
in flag

One way to do this would be via the Terminal:

sudo mount -t cifs -o uid=tidy,username=tidy,password=superSecretPassword!123 //192.168.1.10/tidy-mine /home/guest/f_folder

Note: Be sure to replace superSecretPassword!123 with the actual password you have set.

You will need to create the f_folder directory first, otherwise there will be no place for the share to be mounted to.

Admia avatar
vn flag
I received the error `mount: /media/tidy/f_folder: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program.`
Admia avatar
vn flag
This command worked: `sudo mount -t cifs -o username=tidy,password=My_Password_is_something_secrect //192.168.1.11/tidy-mine /home/digital/tidy `. I have two questions, how can I unmount when I decide to? Also, how can I give the password as a hidden prompt instead of giving the password in plain text?
Admia avatar
vn flag
I found the answers. For un-mounting I use `sudo umount /home/digital/tidy`. For prompting the password I use `sudo mount -t cifs -o username=tidy //192.168.1.11/tidy-mine /media/tidy/f_folder/ `
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.