This is a quick instruction on how to install Samba (CIFS / windows share) on a Ubuntu system. This basic setup works on Ubuntu 8.x to 11.04 and presumably subsequent versions.
The information in this post is mostly extracted from a post on another site. I wanted to collect all the information necessary for putting together my NAS project in one place. Installing Samba Server:
sudo apt-get install samba smbfs; emacs /etc/samba/smb.conf; (or use vi/gedit or your own editor)
- Comment (prepend #) the lines in the [printers] section including the [printers] line
- Same (comment) section [print$]
- At the bottom of the file, create a section for each of the disk / partition that you want to share. Here is what it should look like:
[myraid5] path = /mnt/mydisk/someDirToExport available = yes valid users = My_USERNAME read only = no browsable = yes public = no
- myraid5 is the “share name” (mount on client w //NAS_HOST/myraid5 )
- path: directory you want to export
- available: yes/no – no: SHARE temporarily unavailable for export
- valid users: who can mount this share
- read only: yes/no – no: implies read/write access
- browsable: yes/no – yes: allows client to browse available SHARES on this host
- public: yes/no – yes: gives access to guests
sudo smbpasswd -a USERNAME; (sync this passwd w linux host passwd) sudo restart smbd; sudo testparm; (shows basic smb config and exports) # It also confirms that the samba server is up and running Now you can access is from another computer.
Mounting Samba or windows share from Ubuntu desktop:
sudo apt-get install samba smbclient smbfs
You can mount a windows or samba share using the gui or by editing the /etc/fstab file. To use the GUI, got to “Place–>Connect to Server…”
Select “Windoww share”
Enter server name (or IP address)
Enter the share name (test123 above)
the username you configured on the SAMBA server
If you leave the Domain Name empty, it will assume the default WORKGROUP which should also be the default on the SAMBA Server.
Click “Connect” and a popup window will ask for your password (on the samba server).
Mounting using the command line:
sudo mkdir /media/myraid5 (choose your own mount point) sudo emacs /etc/fstab
Add this line to the file: (using your own server/share/username/password)
//192.168.1.5/myraid5 /media/myraid5 cifs username=scoob,password=XXXX,iocharset=utf8,file_mode=0777,dir_mode=0777
Then mount the share:
sudo mount /media/myraid5
And you should now be good to go! Of course there are many tweaking, special configuration setup which you can feel free to explore. This gives you a solid working setup to work with.