Configuring A Simple File Server

Samba

Installing Samba On The Server

sudo apt-get install samba

sudo useradd filesharer -p <password> -s /bin/false

– creates a user with no access and no home directory (a dummy user)

sudo smbpasswd -a filesharer

– enter same <password> as above (twice)

sudo gedit /etc/samba/smb.conf

– uncomment security = user in the [global] section

[global]
security = user
# guest account = nobody ????

– add a section for each share that looks like this:

[data]
path = /data
browseable = yes
read only = no
guest ok = no
create mask = 0775
directory mask = 0775

sudo /etc/init.d/samba restart

Mounting Shared Folders On a Client

sudo apt-get install smbfs

create /etc/smb_credentials

username=filesharer
password=<password>

sudo chown root smb_credentials
sudo chgrp root smb_credentials
sudo chmod 0600 /etc/smb_credentials

//iceberg/data /data cifs credentials=/etc/smb_credentials,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0
//iceberg/multimedia /multimedia cifs credentials=/etc/smb_credentials,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0

NFS

Install according to other tutorial, this gives /, /home and /data partitions.

To share /data with other Ubuntu machines:

On the server:
[sourcecode language=”bash”]
sudo apt-get install nfs-kernel-server nfs-common
echo "/data 192.168.0.0/24(rw,no_root_squash,async)" | sudo tee -a /etc/exports
sudo exportfs -a
sudo /etc/init.d/nfs-kernel-server restart
[/sourcecode]
On the client:
[sourcecode language=”bash”]
sudo apt-get install nfs-common
sudo mkdir /data
sudo chmod 0777 /data
echo "iceberg:/data /data nfs rw 0 0" | sudo tee -a /etc/fstab
sudo mount -a
[/sourcecode]

Comments are closed.