Posted Thursday, 04 March 2010 at 03:31 by Andrew Liu
Tagged: linux | networking | web development
Read more blogs...
OS: Fedora 10
Accessing a your server's filesystem directly from your windows computer can be achieved by using Samba. Samba has been around for quite a while, and does the job admirably. First thing we need is to install the packages.
> yum install samba Loaded plugins: refresh-packagekit ... Installed: Loaded plugins: refresh-packagekit ... Installed: |
Once installed, we have configuration files located in "/etc/samba". The file we want to modify "/etc/samba/smb.conf".
> vi /etc/samba/smb.conf 74 workgroup = MYGROUP 76 78 79 ; interfaces = lo eth0 192.168.12.2/24 192.168.13.2/24 |
a) The "workgroup" / "server string" lines are equivalent to windows workgroup and computer description. You should fill these out the workgroup to be the same on all your computers in your LAN. Server string is just a short description.
b) "netbios name" is like "computer name" in windows, and it applies to the network only. I think by default it uses your /etc/hostname already, but if you have a preferred computer name, different to your hostname, you should put it in here. Otherwise, leave it commented out.
You can leave "interfaces" and "hosts allow" commented out. This will allow anyone to access samba.
I tend to like having a globally accessible folder over samba. It just makes things less complicated. Unless you have good reason to do otherwise, I suggest doing the same.
To do this, I create a user called "samba". The public folder will be located in this users home directory, called "public".
> useradd samba > cd /home/samba > mkdir public > chmod 777 public > chown samba:samba public > ls -al total 32 |
And now we need to add this folder to the samba configuration file. Add your shares at the bottom as this is the most logical place to put them.
> vi /etc/samba/smb.conf 289 296 directory mask = 0777
|
Finally, we need to add a user to samba. Samba uses its own method to authenticate users and passwords. By using "tdbsam" (which is the default now), we simple add a user using the following command.
> smbpasswd -a samba New SMB password: |
Remember, this password is different to the operating system password (although you can choose the same password if you wish). It is this password that samba uses and will look for.
Restart samba services. Its a little bit more annoying now as you have to do two commands.
> /etc/rc.d/init.d/smb restart Shutting down SMB services: [ OK ] Starting SMB services: [ OK ] > /etc/rc.d/init.d/nmb restart Shutting down NMB services: [ OK ] Starting NMB services: [ OK ]
|
To keep things neat, I like to make a symbolic link on the filesystem from "/public" to the newly created super public folder.
> ln -s /home/samba/public /public
|
To make sure that samba starts when the system boots up, you need to add the services to the appropriate runlevels.
> chkconfig --levels 35 smb on > chkconfig --levels 35 nmb on
|
Posted Tuesday, 19 October 2010 at 05:58 by Andrew Liu
Posted Sunday, 18 April 2010
Updated Sunday, 24 February 2013 at 06:39 by Andrew Liu
Posted Friday, 05 March 2010 at 23:13 by Andrew Liu
Posted Thursday, 04 March 2010 at 04:34 by Andrew Liu
Posted Wednesday, 03 March 2010 at 20:15 by Andrew Liu