Sunday, April 29, 2012

Networking Linux and Windows with SAMBA


Purpose of this Tutorial


The purpose of this tutorial is not to scare you away from using Linux but to encourage you! I will go over the very basics of what you need to get your Linux box and your Windows machine talking seamlessly and cover what needs to be done to accomplish some very basic file sharing capabilities.

Note: This tutorial assumes that tcp/ip is installed and functioning on both the Linux and Windows machine and that all the hardware required for proper communication is configured correctly.

Part 1: What is Samba and Why do I Need It?


To answer this question we need to discuss briefly how Windows machines exchange information and share files. In a small Windows network the initial connection and session setup is handled by NetBios, (Network Basic Input Output System.) It is the job of NetBios to handle any names that need to be resolved and to make sure that all sessions are properly configured from the start and properly terminated when the connection is closed. Once a client has a NetBios session setup with the server he can than access the shared resources provided using a protocol called SMB (Server Message Block.) When a client requests a resource on the network a SMB packet is created with some of the following information.

1. Credentials. Basically your username and password. This lets the server know who you are and what your allowed to do with the resource. (Your permissions.)

and...

2. The requested resource. How the heck do you expect to get anything in return if you dont let the server know what you want?

Although theres a lot more associated with the format of an SMB packet, these are two of the big ones you need to know. Now you may be wondering, well what the heck does this have to do with sharing files with linux!? This is where Samba comes in. You can think of Samba as a unix version of Microsofts smb protocol. It emulates the protocol in such a way that it allows Linux to share files with Windows and (horrors...!) vice versa. In fact it is so effective Windows computers have no idea they're even talking to a linux machine! So to wrap this part up, Samba is the Linux implementation of the smb protocol and allows Linux and windows to share files seamlessly.

Part 2: Installing Samba


To install Samba we need to open a terminal. You can open a terminal either by going to applications--->accessories---->terminal or by switching to one of virtual terminals (ctrl - alt - f5) I prefer a virtual terminal because I am easily distracted by the gui and all of what we will be working with will be done in the shell anyways. Alright, to begin we must install samba through the aptitude package manager. At the prompt type...

    sudo apt-get install samba


You will be prompted for the root password. Enter it and the shell will tell you the size of the package and ask you if you really want to install it. hit [Y] and allow the package to install.

Part 3: Configuring Samba


Once installed a number of directories that pertain to the Samba service and configuration will be created. I will explain the ones we will be using in this section. The first and probably most important is the actual service script itself located in /etc/init.d/samba you will use this script to start, stop and restart the service.

Note: anytime you change the samba configuration you must restart the service for the changes to take effect. the commands to start, stop and restart the service are as follows...

    /etc/init.d/samba stop (stops the service)
    /etc/init.d/samba start (starts the service)
    /etc/init.d/samba restart (restarts the service)

Like alot of applications in Linux all configuration changes that will be made to Samba will be done through its configuration file smb.conf located at /etc/samba/smb.conf So lets get right into it and configure this bad boy. you can use any text editor you feel comfortable with for this step. I prefer vi because its simple and you can expect it to be installed by default on all versions of Linux.

    sudo vi /etc/samba/smb.conf

You will see a lot of information but there are only a few lines that we need to concern ourselves with for basic file sharing. These entries are as follows.

Note: Lines that begin with "#" are considered comments and are ignored by Samba. Also, I like to delete everything from this configuration file and start from scratch so that the only entries in the file are entries I actually use. Doing this makes administration a little bit simpler.

[global]
workgroup = Enter your MS workgroup here

netbios name = The netbios name the samba machine will use

server string = The name you want your server to appear as under network neighborhood

#===== Share Definitions =====
# Configure your Shares under here. You Configure shares like this....

[tmp]
comment = My shares
path = /tmp
read only = No
guest ok = Yes

    # The above share will share the /tmp directory with everybody. No user #name or password required
    # To add some basic security you can restrict access to certain users like so...

[VeronicasDir]
comment = Veronicas Stuff
path = /home/Veronica/Documents
valid users = Veronica
public = no
writable = yes

    #The above share specifies user Veronica as the only valid user able to access #the specified share. On a windows machine you will see a share called #VeronicasDir and the share will require a valid username and password #(veronicas) to access.

Note: In order for user authentication to work properly the user needs to have a valid account on the Linux system and the user needs to have an SMB password configured to work with his or her account. configuring a user account and SMB password is done by using the adduser and smbpasswd commands:

    adduser Veronica

You will be prompted to enter a UNIX password for the user and enter some basic information. Once completed assign the user an smb password:

    smbpasswd -a Veronica

Enter a password. If the user will be accessing the share from a Windows machine it would be wise to use the same username and password so no confusion on the client side will take place. After this step is completed User Veronica can now access her home directory!


Once you have the above smb.conf configuration, save the file and restart the samba service. If you entered everything correctly in the configuration and the samba service is started, you should be able to see and navigate the Linux shares from a windows computer! Congratulations you have succesfully networked Linux and Windows using samba!

Part 4: Accessing a Windows share from Linux


Ok, so we configured Linux so Windows computers can access the shares we specified but what if a Linux machine wants to obtain a resource from a Windows computer? Dont worry, we dont have to configure another text file but we do need to become familiar with the smbclient command. This command uses the smb protocol to view and navigate shares on a windows computer. It is fairly straightforward and some basic commands are as follows.

    smbclient -L host


this will list the remote shares on a windows host and looks something like this:

Domain=[HOST] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]

Sharename Type Comment
--------- ---- -------
My Stuff Disk Put stuff here

Once you know whats on the machine you can now connect to the share:

    smbclient \\HOST\My Stuff


Enter the proper username and password if required and happy sharing! Once your in the directory, most of the basic Linux commands work. you can type help to get a list of commands you can use to manipulate the files.

Final Notes and Some Helpful Links


This is a very basic tutorial for configuring Samba on a windows network. There is a lot you can do with Samba that is not covered here and i encourage you to pursue the options! Whatever the case I hope you found this tutorial informative and most of all i hope the tutorial worked for you! Below you will find some suggested reading that really helped me out when i first started out. Thanks for reading.

http://www.samba.org/
http://www.faqs.org/docs/securing/chap29sec284.html
http://samba.anu.edu.au/cifs/docs/what-is-smb.html

Wednesday, April 18, 2012

Wireless Networking Basics


Wireless networks are very famous for their fast and the reliable working among the people of the modern World. But the people who do not like this technology and feel jealous with it and trying to do the activities that can hack the particular network and decode all the personal information of the users on the network. Basically wireless network hacking is defined as the set of different types of techniques or the tools to hijack the network through unauthorized mean with out the permission of any body and breaks the security of the network. Hackers use different types of hacking techniques to break the security of the wireless network and decode all the information such as passwords, MAC addresses, and many more secret things.

How Hacker hack the Wireless Network? 

In the past that hacking technology was used to check the security measure either the system or the network is secured or not but nowadays people use this technology for unfair means and for hijacking purposes. There are different techniques or the methods that are used by the hackers to break the security and hack the network. But some common techniques are as follows
  • Network Enumeration
  • Wireless Network Spoofing
  • Wireless Network Probing
  • Wireless Network Sniffing

Network Enumeration:

First of all the hacking process starts with the initial step, in the first step the data and the information about the wireless network is collected wit the help of any possible way , that phenomenon is referred to as the network enumeration. Hackers use different types of applications or the software to collect the important information about the network. Some of the important applications used by the hackers to hack the wireless networks are WarXing that operates with the help of computer or the laptops. Some other applications such as Kismet or network stumbler also used for the same purpose.

Wireless Network Spoofing:

It is the type of technique that is used by the hackers to crack the security and hack whole wireless networking system. It is the very strong technique that is used by the attackers to attack on the both wired and the wireless networks security and hijack them. In this technique hackers use different types of applications and the software to locate and identify the different types of addresses pf the network such as IP or MAC by filling the particular fields with the addresses. There are different types of spoofing in which the hackers deals with the specific addresses such as MAC spoofing, IP spoofing and frame spoofing

Wireless Network Sniffing:

An important technique used by the hackers to hack the wireless networks is the wireless network sniffing. In this process sniffer is used, sniffer is the program that is used by the hackers to breaks and decodes the secret information of the wireless network traffic broadcasting. Through this program hackers are also able to hijack the wired networks also. But sniffing of the wireless networks is quite easy and convenient for the hackers as compared to the wired networks.

Wireless Network Probing:

If some amount of information is missing after spoofing and sniffing of the networks then the hackers try to use the wireless network probing technique. In this technique hackers construct the artificial data packets and spread them over the network and attacks on the specific target. It is called as wireless network probing.

Prevention of Wireless Network Hacking:

Where there are different techniques to hack the wireless networks, some protection techniques are also used which are as follows
  • By encryption of the wireless traffic of wireless networks
  • Password protections
  • Change the default name and password of SSID