Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
mounting smb on ubuntu

I use sshfs to mount remote servers. but I also want to connecting windows servers to my ubuntu.

If there's one good thing that I can say about Windows XP is that it supports the SMB protocol. This enables a computer running Windows to share files, folders, and more with another PC. All that other PC needs is the right software to take advantage of the SMB protocol. Luckily, that software is available for GNU/Linux.

on mac, I can click the Finder bar --->Go---> Connect to Server and then type in the address. I will show you how to do it on ubuntu.

Install

First, install cifs-utils

sudo apt-get install cifs-utils

I got Hash Sum mismatch errors:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  keyutils libsmbclient libwbclient0 python-crypto python-ldb python-samba python-tdb samba-common samba-common-bin samba-libs
Suggested packages:
  smbclient winbind python-crypto-dbg python-crypto-doc heimdal-clients
The following NEW packages will be installed:
  cifs-utils keyutils python-crypto python-ldb python-samba python-tdb samba-common samba-common-bin
The following packages will be upgraded:
  libsmbclient libwbclient0 samba-libs
3 upgraded, 8 newly installed, 0 to remove and 353 not upgraded.
Need to get 7,317 kB of archives.
After this operation, 11.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 samba-libs amd64 2:4.3.11+dfsg-0ubuntu0.16.04.8 [5,178 kB]
Err:1 http://security.ubuntu.com/ubuntu xenial-security/main amd64 samba-libs amd64 2:4.3.11+dfsg-0ubuntu0.16.04.8
  Hash Sum mismatch

After googel around, I

sudo apt-get clean

# now it works
sudo apt-get update
sudo apt-get install cifs-utils

Mount

# make a folder where the remote server will be mounted
sudo mkdir /mnt/genomic_med
 
sudo mount -t cifs -o username=mtang1 //d1prpccifs/genomic_med /mnt/genomic_med
#You will be promoted to type in the password.
Password for mtang1@//d1prpccifs/genomic_med:  ********

check if you can access the mounted server:

ls /mnt/genomic_med

Worked :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment