Creating a wireless Ad-hoc network in GNU/Linux for sharing files

Screenshot from 2013-05-15 12:03:12

Here I explain what I did in Ubuntu 12.04 LTS. And will probably be similar in most of the GNU/Linux distros. This method requires a network manager for managing the different networks. First of all you need to ensure that your wireless interface card supports Ad-hoc networking. Because there are some which doesn’t support wireless Ad-hoc networks. Know your network controller by running lspci | grep -i network. Given below is a list containing some of the network controllers that supports Ad-hoc and there may be more in the list.

Atheros
Broadcom
Intel
Ralink

Step 1: Right click on the network manager icon->Edit connections. Now you will get a window similar to one displayed above.
If not try the Network Connections from the Preferences section.
Step 2: Click on the tab Wireless->Add.
Step 3: Enter the SSID as the name that should be displayed as the network name.
Step 4: Click on the Mode drop-down list to select Ad-hoc. Leave the remaining fields as it is.
Step 5: Click on the Wireless Security tab for adding a password and select one of the Security types listed.
Step 6: Type a password->Save.
If you need a static ip address then follow the sub-steps before saving
Step 6.a) Click the tab IPv4 settings and select the method as Manual.
Step 6.b) Click on add and then type a valid ip in Address section, 255.255.255.0 as Netmask and 0.0.0.0 as Gateway then Save.
Step 7: Click on the network icon again-> Connect to a hidden wireless network.
Step 8: Select the newly created network->Connect.

That’s all. Now this network will be shown in nearby computer’s network list.

Change the host/computer name and bluetooth name in GNU/Linux

Hostname is the computer name, usually displayed in user@hostname format after login. This hostname is the name you gave during the installation of the GNU/Linux i.e, the computer name. Most of us wish to change this name afterwards. Here is a simple way described to perform the action.

1. sudo nano /etc/hostname
2. Just replace the whole thing i.e, the present hostname with the new one.
3. Save the file
4. sudo nano /etc/hosts
5. Edit the second line starting with 127.0.1.1 by replacing the current hostname with the same one you entered in /etc/hostname.
6. Save the file and logout.

During the next login changes will be made.

Another important thing is about the bluetooth name visible to others during file transfer. In Ubuntu I think the default name is ‘ubuntu-0’. Don’t you feel shame to have such a bluetooth name? It is your freedom to set a name of your own. That’s the power of GNU/Linux. Don’t worry at all. GNU/Linux is also capable of changing this name too. For the change to come true,

1. cd /var/lib/bluetooth
2. There will be a directory with your bluetooth device MAC address (Most probably only that will be the only one inside this directory). Get into
that directory.
3. sudo nano config
4. Substitute the perefered name adjacent to ‘name’ written as the first line.
5. Save the file.
6. Restart the bluetooth by sudo service bluetooth restart.

Now you can have that name in the bluetooth settings and accordingly as the public visible name.

Disable Ctrl-Alt-Del keyboard shutdown command in GNU/Linux

Image

Don’t think this as a flaw to the GNU/Linux system, but can be helpful in many situations. This part plays a vital role in the security of a system. In GNU/Linux system pressing Ctrl+Alt+Del can cause a shutdwon/reboot by default. As I said this isn’t a bad configuration and most of us may be using this as a shortcut. Moreover it is pretty important if you don’t have the best physical security to the machine. Commenting out the following line/lines will disable the possibility of using the Control-Alt-Delete command to shutdown your computer.

In debian based distros
nano /etc/init/control-alt-delete.conf

   Comment out the lines in the file to look like
   # control-alt-delete – emergency keypress handling
  #
   # This task is run whenever the Control-Alt-Delete key combination is
  # pressed, and performs a safe reboot of the machine.

  description     “emergency keypress handling”
  #author         “Scott James Remnant <scott@netsplit.com>”

  #start on control-alt-delete

  #task
  #exec shutdown -r now “Control-Alt-Delete pressed”

In redhat based distros
nano /etc/inittab

Comment the following line

    ca::ctrlaltdel:/sbin/shutdown -t3 -r now

to look like

    #ca::ctrlaltdel:/sbin/shutdown -t3 -r now
Save the file and logout.