Samba
Samba is useful for a creating a Network directory and share it with other PC, especially Windows.
Server
For creating a server who shares a drive
Installation Server
sudo apt-get install samba
Configuration
Under global
add the following lines or uncomment them in your file etc/samba/smb.conf
/etc/samba/smb.conf | |
---|---|
1 2 3 4 5 6 7 8 9 |
|
User
# Create User
sudo smbpasswd -a username
New SMB password:
Retype new SMB password:
Added user username.
# Activate User
sudo smbpasswd -e username
Enabled user username.
Creating Share
Add the end of the file /etc/samba/smb.conf
add your shares
/etc/samba/smb.conf
[multimedia]
comment = multimedia
path = /mnt/multimedia
browseable = yes
read only = no
Restart Samba
# Linux in general
sudo /etc/init.d/samba restart
# Ubuntu >10.04
sudo initctl restart smbd
Test
To test samba and display all available shares for the current user type:
smbclient -L <hostname or ipname>
Client
For mounting a shared drive
Installation Client
Install samba tools.
sudo apt-get install samba smbfs
Create shared folder
Create before an empty folder where you want to mount your samba drive.
sudo mkdir /mnt/shared_folder_name
Set Up FSTAB
Open etc/fstab
file and add a new entry.
/etc/fstab
# only read access
//SERVER/shares /MOUNTPOINT smbfs username=samba_user,password=samba_pass 0 0
# read / write access
//SERVER/shares /MOUNTPOINT smbfs username=samba_user,password=samba_pass,uid=this_user,gid=this_group 0 0