...

Saturday, March 27, 2010

Misc 15

I said I wanted to make this post a few articles ago but I forgot. It's time to implement samba! Samba is a reimplementation of the SMB/CIFS protocol for Linux. SMB/CIFS is the file sharing protocol used by Windows. Implementing samba allows your Windows clients to connect to Linux through the network as if you're connecting to another Windows client.
Let's begin by installing samba:
apt-get install samba

After installation, you already have the necessary settings. The next step is simply to assign a password to accounts that you wish to allow access through the samba server and you're done! To do this, type:
smbpassword user

You need to do this as root. After you're done, you should be able to log in from Windows by typing \\ in front of your IP address. For me, I'll type \\1.1.1.2. You will now be able to log in as users in your Linux box.

By default you'll have access to only your files in your home folder. To add more folders, you'll need to edit the /etc/samba/smb.conf file. Before we do anything, we may want to change the netbios name. At the time of typing, the config does not allow any specification of the netbios name. To fix this, type this anywhere in smb.conf (I usually type this above workgroup):
netbios name = KELVIN-DEBIAN

Now, scroll all the way down till you're at the Share Definitions section. This is where you create a new share. To share /etc/apache2/ to everyone, type this just above the sample share for CDROM at the bottom:
[apache2]
comment = The Apache 2 configurations folder.
read only = no
path = /etc/apache2/
guest ok = no
browseable = no
valid users = root


Setting browseable to no will remove it from the list. You'll have to manually type in \\1.1.1.2/apache2 to go to the location.

The read only attribute will prevent modifications.

To restrict access to only the root user, the "valid users" attribute is used. Use spaces as a delimiter for multiple users.

No comments :

Post a Comment

<