Frequently Asked Questions

« Previous
We have a server, where should we put it?
Next «
How do I change my primary e-mail address?

68. How do I mount SMB share in Linux?

Command line

  1. If you are running Ubuntu make sure the package cifs-utils is installed by running the command:

    apt-get install cifs-utils

  2. To mount an SMB-share on the command line in Linux, first create a directory where to mount the share: example like this:

    mkdir /mnt/myfiles

  3. Then mount:

    mount -t cifs -o domain=USER,username=jny25782,password=XXX '//inv-users.files.uu.se/inv-users$/jny25782' /mnt/myfiles

    If you want to be prompted for a password try this instead where the password is not specified.

    mount -t cifs -o domain=USER,username=jny25782 '//inv-users.files.uu.se/inv-users$/jny25782' /mnt/myfiles

  4. Newer versions of Ubuntu do not fall back to older versions of the SMB protocol. Then please specify what version you want to use. In this example Ubuntu 17.10 is used connecting to the Hitachi NAS service at UU.

    mount -t cifs //inv-users.files.uu.se/INV-Common$/ /mnt/myfiles -o domain=USER,username=jny25782,password=XXX,vers=2.0

Permanently

To do this permanently add the following line (as a root user) in the file /etc/fstab

  1. First check your uid (uidNumber) as your normal user:

    id -u

  2. Then enter this line as an administrator in the file /etc/fstab.

    //inv-users.files.uu.se/inv-users$/jny25782 /mnt/myfiles cifs domain=USER,username=jny25782,password=XXX,uid=1000,iocharset=utf8 0 0

  3. Now the normal user with id 1000 should be able to access the files in /mnt/myfiles

Temporarily on an Ubuntu desktop

  1. Start the file browser and open Connect to server...
  2. Enter the path:

  3. Enter your credentials

This entry mount.smb.linux was last modified 2018-04-09

This documentation is covered by GNU Free Documentation License.