Access Windows Directories from ubuntu

Posted by {"display_name"=>"greg", "login"=>"greg", "email"=>"greg@udon.org", "url"=>""} on May 13, 2011 · 1 min read

Want to access your remote windows (SMB) directories or shares from Ubuntu Linux? Everything you need to know is nicely summarized on on the ubuntu.com Mount Windows Shares page.

In short:

$ sudo apt-get install smbfs
$ sudo update-rc.d -f umountnfs.sh remove
$ sudo update-rc.d umountnfs.sh stop 15 0 6 .

Create a file in your home directory called .smbcredentials and insert the values associated with the remote directory or share that you want to access:

username=<username>
password=<password>

Edit the /etc/fstab and add the following line to the end, inserting the info for the share you want to mount and the location for it to be mounted.

//<smbserver>/<smbshare> /media/<smbshare> smbfs iocharset=utf8,credentials=/home/<username>/.smbcredentials,uid=$UID 0 0" >> /etc/fstab

Execute the following commands:

$ sudo chown root .smbcredentials
$ sudo chmod 600 .smbcredentials
$ sudo cp /etc/fstab /etc/fstab.bak
$ UID=`grep $USERNAME /etc/passwd | cut -d: -f3`
$ GID=`grep ^$USERNAME /etc/group | cut -d: -f3`
$ sudo mkdir /media/<smbshare>
$ sudo mount -a