Friday, 30. December 2005, 19:43:57
If you wanna connect to Windows box or Linux box or allow Windows box to connect to you, you would like to enable samba.
What is samba ?
When you type whatis samba, it returns "A Windows SMB/CIFS fileserver for UNIX.". My interpretation is samba is a "protocol" that allows file sharing within Unix, Mac and windows system.
How to do it ?
Different distro have a slide different to configure it. I am using ubuntu, so bellow is how i do it to my ubuntu box. It is similar and it is not difficult to set up.
Check whether is it samba daemon is loaded.
ps aux | grep samba
As long as you get result return that means your samba daemon is running.(not included process of "grep smbd") Else, start you samba with :
sudo /etc/init.d/samba start
This will start you samba daemon, but it will not start automatically after your machine reboot. What you have to do is goto /etc/rc2.d ( for ubuntu, default run level is 2 )
cd /etc/rc2.d
sudo mv K20samba S20samba
p/s: To ensure the symlink for samba, "ls | grep samba", default should be K20samba
Okay now you can start configure your samba configuration file.
sudo vi /etc/samba/smb.conf
p/s: In case you don't use vi, then do this
sudo gedit /etc/samba/smb.conf
Search for the keywords "[homes]"
You will get something like this:
wins support = no
[homes]
comment = Home Directories
browseable = no
# 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
Change to writable = yes and save and close the file.
Now you need to restart the samba daemon:
sudo /etc/init.d/samba restart
Okay now, the last steps, add/change samba user password.
sudo smbpasswd -U username
username is your username and if it doesn't work, that means this user doesn't have samba password set, you may try this:
sudo smbpasswd -a username
You are done! Now you may try to access windows box, what you need is your windows box ip
Open a file browser or nautilus to be specific, and put in this:
smb://your-ip
p/s: ctrl+L if you can't find a place to key in your location.
You may type command like bellow or make a launcher to your desktop:
nautilus --browser smb://your-ip
How about my windows user wanna access my linux box?
Easy, go explorer browser put :
\\your-ip
Type in correct username and password, you are done.
If it doesn't work, this might be your firewall blocked the port needed. Allow these port :
445:tcp
139:tcp
138:udp
137:udp
For more information, google it lah!
An interesting wiki about samba can get it
here