How to mount SMB shares on Ubuntu 22.04

SMB (Server Message Block) is known as Client-Server and it is used to transfer files and also manage the other computers connected through local area network on the same network. In SMB, shares are those files and folders that are shared and can be accessed by other computers connected to the same network.

A method has been discovered in this blog that we can use to mount the SMB shares on Ubuntu 22.04.

How to mount SMB shares on Ubuntu 22.04

To mount the SMB shares on Ubuntu, we need to make sure that the other utilities and dependencies of SMB shares are installed with the following command:

$ sudo suitable To install cifs-utils -y

Now create a directory where you have shared the files and folders that you want to be accessible from the other computers on the same network:

$ sudo mkdir /media/Split

The next step is to create the credentials file, but to keep it safe, hide it with the “.” command:

$ sudo nano /root/.example credentials

Copy and paste the following script into the newly opened file:

username=example_username

password=example_password

Save the file with CTRL+S and exit the editor with the shortcut CTRL+X and then change its access permissions with the command:

$ sudo chmod 400 /root/.sample credentials

The next step is to find out the IP address of the computer using the following command:

$ IP a

Now run the command mentioned below, substituting the IP address of the machine:

$ sudo assemble -t cifs -O rw,verse=3.0,credentials=/root/.example credentials //172.20.10.10/sharedDir /media/Split

Another method to mount the SMB share is manually, and for this we need to open the file with the nano text editor:

$ sudo nano /Etc/fstab

A file will open, at the end copy and paste the following line, replacing the IP address:

//172.20.10.10/Split /media/share cif verse=3.0,credentials=/.sample credentials

Exit the editor by saving the changes made to the /etc/fstab file.

Conclusion

Using the cifs utilities, SMB shares can be mounted on Ubuntu by installing them with the command “sudo apt install cifs-utils -y”. This blog explored two different methods of mounting the SMB shares on Ubuntu 22.04.

Related Posts