How to use smb to mount a directory of an ubuntu server on an ubuntu guest machine?
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?
Solution 1:
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_folder
if you really want to but I would advice against it. It is so easy to mess up when you use
/home`.
-
Solution 2:
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.