Thursday, February 28, 2008

Samba Server Ubuntu 6.06

Samba adalah program aplikasi yang mengimplementasikan protokol Server Massage Block (SMB) di lingkungan Unix atau Linux. Protokol ini mempunyai fungsi utama untuk berbagi (sharing) file dan printer. Samba dapat menjadi jembatan untuk mengatasi masalah komunikasi antar jaringan, baik dalam lingkungan Linux/unix maupun platform lainya.

How to install Samba Server for files/folders sharing service
plilih menu Applications/Accessories/Terminal
ketik su [enter]
Password:

sudo apt-get install samba smbfs

How to add/edit/delete network users
To add network user:
sudo smbpasswd -a system_username

gksudo gedit /etc/samba/smbusers

Insert the following line into the new file

system_username = “network username”

Save the edited file

To edit network user:
sudo smbpasswd -a system_username

To delete network user:
sudo smbpasswd -x system_username


How to share home folders with read only permission (Authentication=Yes)
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
gksudo gedit /etc/samba/smb.conf

Find this line

; security = user

Replace with the following lines

security = user
username map = /etc/samba/smbusers

Save the edited file

sudo testparm
sudo /etc/init.d/samba restart

How to share home folders with read/write permissions (Authentication=Yes)
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
gksudo gedit /etc/samba/smb.conf

Find this section

# By default, the home directories are exported read-only. Change next
# parameter to ‘yes’ if you want to be able to write to them.
writable = no

Replace with the following lines
# By default, the home directories are exported read-only. Change next
# parameter to ‘yes’ if you want to be able to write to them.
writable = yes

Save the edited file

sudo testparm
sudo /etc/init.d/samba restart

How to share group folders with read only permission (Authentication=Yes)
sudo mkdir /home/group
sudo chmod 777 /home/group/
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
gksudo gedit /etc/samba/smb.conf

Append the following lines at the end of file
[Group]
comment = Group Folder
path = /home/group
public = yes
writable = no
valid users = system_username1 system_username2
create mask = 0700
directory mask = 0700
force user = nobody
force group = nogroup

How to share group folders with read/write permissions (Authentication=Yes)
sudo mkdir /home/group
sudo chmod 777 /home/group/
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
gksudo gedit /etc/samba/smb.conf

Append the following lines at the end of file
[Group]
comment = Group Folder
path = /home/group
public = yes
writable = yes
valid users = system_username1 system_username2
create mask = 0700
directory mask = 0700
force user = nobody
force group = nogroup

Save the edited file

sudo testparm
sudo /etc/init.d/samba restart

How to share public folders with read only permission (Authentication=Yes)
sudo mkdir /home/public
sudo chmod 777 /home/public/
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
gksudo gedit /etc/samba/smb.conf

Append the following lines at the end of file
[public]
comment = Public Folder
path = /home/public
public = yes
writable = no
create mask = 0777
directory mask = 0777
force user = nobody
force group = nogroup

Save the edited file

How to share public folders with read/write permissions (Authentication=Yes)
Append the following lines at the end of file
[public]
comment = Public Folder
path = /home/public
public = yes
writable = yes
create mask = 0777
directory mask = 0777
force user = nobody
force group = nogroup

How to share public folders with read only permission (Authentication=No)
security = share

Append the following lines at the end of file
[public]
comment = Public Folder
path = /home/public
public = yes
writable = no
create mask = 0777
directory mask = 0777
force user = nobody
force group = nogroup

Save the edited file

udo testparm
sudo /etc/init.d/samba restart

How to print on remote Ubuntu machine via samba
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.backup
gedit /etc/samba/smb.conf

Find the following lines

# printing = cups
# printcap name = cups

and uncomment them.
printing = cups
printcap name = cups

Restart cups server
sudo /etc/init.d/cupsys restart

Now printers working on your Ubuntu machine should be acessible via samba.

How to permanently mount a samba share
Example names:
Remote machine: remotehost
Remote username: remoteuser
Remote password: remotepass
Remote share name: remoteshare
Local username: localuser
Local mountpoint: /home/localuser/mnt/
sudo apt-get install samba smbfs
sudo gedit /root/.smbcredentials

In the .sbmcredentials file put the appropriate username and password to access the samba share in the following format:
Password:
username=remoteuser
password=remotepass

Save and close the edited file

Open /etc/fstab
sudo gedit /etc/fstab

Add the share to /etc/fstab using the .smbcredentials file by appending the following line.

NOTE: Substitute the appropriate remote machine, remote share name, and local mount point to this line before appending to /etc/fstab
//remotemachine/remoteshare /home/localuser/mnt/ smbfs credentials=/root/.smbcredentials,dmask=777,fmask=777 0 0

This share will always mount when the computer starts if the samba server on the remote machine is running properly. The share can also be accessed by all users. To mount the new share immediately type the following command:

sudo mount -a

Sumber:
http://ubuntuguide.org/wiki/Dapper#How_to_install_Samba_Server_for_files.2Ffolders_sha

No comments:

Search This Blog