Windows shares in Ubuntu server

Until now I have always used SMBFS as protocol to mount Windows shares on a Ubuntu server.
SMBFS (with webmin) is an easy way to add all your current shares and make them read/writable with the root user. But because of security reasons I’m stepping back on using the root user everywhere, this brought me to the problem that I only could read on my SMBFS mounts.

After some internet searching I came across a solution: CIFS

CIFS is a different protocol then SMBFS but it can also mount Windows Shares with ease.
It is also a lot more secure because we are saving the share credentials in a secure file instead of putting them in fstab file.

The following is tested with Ubuntu Server 10.04 & Windows Server 2008 R2

1) Open a Terminal and enter the following:
Code:

The output will be something similar to:
Code:

Make a note of the uid and gid.

2) Make the following entry in your /etc/fstab file :

If you don’t need a user name and password to access a samba share add this line:
Code:

If you need a user name and password to access a samba share add this line and proceed to the next 2 steps:
Code:

Modify the server_name, share_name, mount_path, UID value and GID value to suit your environment.

4) Add the following in /root/.smbcredentials:
Code:

Where myusername and mypassword is the user name and password to access the samba share.

5) Set the following permission to /root/.smbcredentials
Code:

6) Now try to login as a particular user and see whether you able to read and write to the share.

Reference: CIFS man page

2 thoughts on “Windows shares in Ubuntu server

  1. Hey there! Would you mind if I share your blog with my zynga
    group? There’s a lot of people that I think would really enjoy your content. Please let me know. Thank you

Leave a Reply

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

*