Software & AppsOperating SystemLinux

Mounting SMB Share with GVFS from Command Line

Ubuntu 5

In this tutorial, we will be discussing how to mount an SMB share with GVFS from the command line. This is a useful technique when working with shared resources on a network.

Quick Answer

Yes, it is possible to mount an SMB share with GVFS from the command line. Simply use the gio mount smb://<server>/<share> command, replacing <server> with the server name or IP address, and <share> with the name of the shared folder. Enter your credentials when prompted, and you’ll be able to access the mounted share as if it were a local file on your system.

What is SMB and GVFS?

SMB (Server Message Block) is a protocol for sharing files, printers, serial ports, and other resources between computers. It’s commonly used in Windows environments but also supports other platforms.

GVFS (GNOME Virtual File System) is a virtual file system implementation for GNOME, which allows applications to access remote servers and services as if they were local files. This includes support for SMB shares.

Prerequisites

You’ll need to have GVFS installed on your system. Most Linux distributions with GNOME should have GVFS installed by default. If not, you can install it using your distribution’s package manager.

Mounting SMB Share

To mount an SMB share using GVFS from the command line, follow these steps:

Step 1: Open Terminal

Open a terminal window. This can usually be done by searching for ‘Terminal’ in your system’s application menu.

Step 2: Mount the SMB Share

Run the following command to mount the SMB share:

gio mount smb://<server>/<share>

Replace <server> with the server name or IP address, and <share> with the name of the shared folder.

This command uses the gio tool, which is part of GVFS, to mount the SMB share. The smb://<server>/<share> part of the command is the URL of the SMB share.

Step 3: Enter Credentials

You will be prompted to enter the required information. Provide the username, domain (workgroup), and password for the share when prompted.

Step 4: Access the Mounted Share

Once the share is mounted, you can access it through the GVFS mount point. The mount points are located in /run/user/<uid>/gvfs/ or $XDG_RUNTIME_DIR/gvfs/.

The <uid> is the user ID of the current user. You can find the user ID by running the id command in the terminal.

Step 5: Create a Symlink (Optional)

If you want to access the mounted share through the command line, you can create a symlink to the GVFS mount point using the following command:

ln -si $XDG_RUNTIME_DIR/gvfs/mysmbmount $HOME/smb

Replace mysmbmount with the appropriate mount point name. This command creates a symbolic link (symlink) from the GVFS mount point to a directory in the user’s home directory, making it easier to access.

Conclusion

Mounting an SMB share using GVFS from the command line is a straightforward process that can make working with network resources much easier. By following these steps, you should be able to mount an SMB share and access it as if it were a local file on your system.

Remember to replace the placeholders in the commands with the actual values for your specific situation. If you encounter any issues, make sure to check the server name, share name, and your credentials.

What is GVFS?

GVFS stands for GNOME Virtual File System. It is a virtual file system implementation for GNOME, which allows applications to access remote servers and services as if they were local files. It provides support for various protocols, including SMB.

What is SMB?

SMB stands for Server Message Block. It is a protocol for sharing files, printers, serial ports, and other resources between computers. It is commonly used in Windows environments but also supports other platforms.

How do I check if GVFS is installed on my system?

You can check if GVFS is installed on your system by running the command gvfs --version in the terminal. If GVFS is installed, it will display the version number. If it is not installed, you can install it using your distribution’s package manager.

Where can I find the GVFS mount points?

The GVFS mount points are located in either /run/user/<uid>/gvfs/ or $XDG_RUNTIME_DIR/gvfs/. The <uid> is the user ID of the current user, which can be found by running the id command in the terminal.

How can I access the mounted SMB share through the command line?

Once the SMB share is mounted using GVFS, you can access it through the GVFS mount point. You can navigate to the mount point directory using the cd command and access the files and folders as if they were local.

Can I access the mounted SMB share through a symlink?

Yes, you can create a symlink to the GVFS mount point for easier access. Use the command ln -si $XDG_RUNTIME_DIR/gvfs/mysmbmount $HOME/smb, replacing mysmbmount with the appropriate mount point name. This will create a symbolic link (symlink) from the GVFS mount point to a directory in your home directory, making it easier to access the mounted share.

Leave a Comment

Your email address will not be published. Required fields are marked *