Best Way to Edit sudoers File in Linux

In Linux, the sudoers file present in the /etc directory will determine the permissions and other settings  while the sudo command is used. If you edit the file directly using terminal or using an editor, if there is any error in your code, the whole sudo command will break. So it is not the best way to edit the sudoers file.

The best way to edit the sudoers file is to use the following command :

$ sudo visudo

This will open the sudoers file in vi editor and you will be able to edit the file here. Once you try to save, it will check for errors and will let you know the same with options to save, not save or re-edit the file.

So it is the safer option while trying to edit sudoers file.

Combining the Contents Multiple Files into a Single File Using Terminal

In this article, you will see how to combine the contents of multiple files into a single file using terminal. Lets consider a list of files with names “xaa”, “xab”, “xac” and “xad”. First lets see the contents of those files :

$ cat xaa

A$ cat xab

B$ cat xac

C$ cat xad

$

As you can see, those files contain the alphabets, A, B, C and the new line character respectively. Now if you want to concatenate the contents of those files, here is how you can do that.

$ cat x*>output.txt

Now this will concatenate the contents of those files and write it into a new file with name “output.txt”. Now you can see the contents of this new file to see the result.

$ cat output.txt

ABC

As you can see, the created file will have the content same as that of the concatenation of those original individual files.

Combining the Contents of Multiple Files Using Terminal

In this article, you will see how to combine the contents of multiple files using terminal. Lets consider a list of files with names “xaa”, “xab”, “xac” and “xad”. First lets see the contents of those files :

$ cat xaa

A$ cat xab

B$ cat xac

C$ cat xad

$

As you can see, those files contain the alphabets, A, B, C and the new line character respectively. Now if you want to concatenate the contents of those files, here is how you can do that.

$ cat x*

ABC

$

Now you will get the concatenated output.

Splitting a File Into Multiple Files Using Terminal

In this article, you will see how to split a file into multiple files via terminal in MAC. Lets consider a file name “sample.txt” with the content “ABC“.

$ cat sample.txt

ABC

Now you can split this file using the following command.

$ cat sample.txt | split -b 1

This command will split the content of the file “sample.txt“ into multiple files the size of the split file content will be determined by the last parameter, which will determine the number of byte by which the string need to be split. In this example, the string will be split into multiple files of byte 1.

Now lest use the ls command to list the contents of the folder.

$ ls -l

total 40

-rw-r–r–  1 user  staff  4 Oct 28 14:39 sample.txt

-rw-r–r–  1 user  staff  1 Oct 28 14:39 xaa

-rw-r–r–  1 user  staff  1 Oct 28 14:39 xab

-rw-r–r–  1 user  staff  1 Oct 28 14:39 xac

-rw-r–r–  1 user  staff  1 Oct 28 14:39 xad

As you can see, 4 new files will be created, named in a sequential format. Now lets see the contents of each file.

$ cat xaa

A$ cat xab

B$ cat xac

C$ cat xad

$

As you can see, each file will contain one byte of the original file data.

Splitting a String Into Multiple Files Using Terminal

In this article, you will see how to split a string into multiple files via terminal in MAC.

 

$ echo ABC|split -b 1

 

This command will split the string “ABC“ into multiple files the size of the split file content will be determined by the last parameter, which will determine the number of byte by which the string need to be split. In this example, the string will be split into multiple files of byte 1.

 

Now lest use the ls command to list the contents of the folder.

 

$ ls -l

total 32

-rw-r–r–  1 user  casino online staff  1 Oct 28 13:18 xaa

-rw-r–r–  1 user  staff  1 Oct 28 13:18 xab

-rw-r–r–  1 user  staff  1 Oct 28 13:18 xac

-rw-r–r–  1 user  staff  1 Oct 28 13:18 xad

 

As you can see, 4 new files will be created, named in a sequential format. Now lets see the contents of each file.

 

$ cat xaa

A$ cat xab

B$ cat xac

C$ cat xad

 

$

 

As you can see, each file will contain one byte of data.

 

How to Echo the Contents of a File in Terminal

The Linux command used to echo the contents of a file in terminal is “cat”. Here is how to use it :

 

Consider a text file, “sample.txt” inside a folder “Testing”. Here are the steps to follow to echo the contents of the file “sample.txt” in terminal.

 

1. Go to the folder in which the file is located using the “cd” command.

 

$ cd Testing/

 

Now your terminal window will point to this path.

 

2. Use the following command to echo the contents of the file in the terminal.

 

$ cat sample.txt

Sample test file with some content inside the folder Testing.

 

So you will get the output like this.

 

How to Edit Android Kernels in Ubuntu

The Android kernel is derived from the Linux kernel. It relies on the core services of Linux, such as security, memory, network and process management. To make amendments to the Android core and include or unlock certain abilities, you must edit and compile your own Android kernel. The Ubuntu operating system is one of the best platforms to edit and compile Android kernels on, and it’s easy to install everything you need.

Instructions

  • 1

    Select “Accessories” from the main menu and click on “Terminal” to open the application. The Terminal is similar to the Windows Command Prompt.

  • 2

    Type the following in the Terminal and press “Enter” to install Java:

    sudo apt-get install sun-java5-jdk

    Use the password you use to log in to Ubuntu when you are asked for a password. This gives the application root privileges.

  • 3

    Run the following commands in the Terminal to install the rest of the tools required to edit Android kernels:

    sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev valgrind

  • 4

    Create the required folder structure, get a copy of the Android repository script, and give full read and write access to the script by running these commands in the Terminal:

    cd /home/*your-user-name
    mkdir myandroid
    mkdir bin
    curl http://android.git.kernel.org/repo > ~/bin/repo
    chmod a+x ~/bin/repo

  • 5

    Go to the “myandroid” folder and download the Google tools and Android source, using the repository script you’ve downloaded earlier. Do this by running these commands in the Terminal:

    cd ~/myandroid
    ~/bin/repo init -u git://android.git.kernel.org/platform/manifest.git
    ~/bin/repo sync

  • 6

    Copy and paste the following command in the Terminal and press “Enter” to run it:

    echo “—–BEGIN PGP PUBLIC KEY BLOCK—–
    Version: GnuPG v1.4.2.2 (GNU/Linux)

    mQGiBEnnWD4RBACt9/h4v9xnnGDou13y3dvOx6/t43LPPIxeJ8eX9WB+8LLuROSV
    lFhpHawsVAcFlmi7f7jdSRF+OvtZL9ShPKdLfwBJMNkU66/TZmPewS4m782ndtw7
    8tR1cXb197Ob8kOfQB3A9yk2XZ4ei4ZC3i6wVdqHLRxABdncwu5hOF9KXwCgkxMD
    u4PVgChaAJzTYJ1EG+UYBIUEAJmfearb0qRAN7dEoff0FeXsEaUA6U90sEoVks0Z
    wNj96SA8BL+a1OoEUUfpMhiHyLuQSftxisJxTh+2QclzDviDyaTrkANjdYY7p2cq
    /HMdOY7LJlHaqtXmZxXjjtw5Uc2QG8UY8aziU3IE9nTjSwCXeJnuyvoizl9/I1S5
    jU5SA/9WwIps4SC84ielIXiGWEqq6i6/sk4I9q1YemZF2XVVKnmI1F4iCMtNKsR4
    MGSa1gA8s4iQbsKNWPgp7M3a51JCVCu6l/8zTpA+uUGapw4tWCp4o0dpIvDPBEa9
    b/aF/ygcR8mh5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oa+jv2QSTlrx4KLM=
    =Wi5D
    —–END PGP PUBLIC KEY BLOCK—–“> /tmp/android.gpg

  • 7

    Run the following commands in the Terminal to copy the key from the temporary file to the keyring and delete the temporary file:

    gpg –import < /tmp/android.gpg
    rm -rf /tmp/android.gpg

  • 8

    Open the Web browser and navigate to HTCDev’s Kernel Source Code page (see Resources). Click on the “Download” button next to the “HTC EVO Shift 4G (Sprint WWE) – MVNOCRC – 2.6.32 kernel source code” entry. Save the file on your desktop.

  • 9

    Run this command in the Terminal to create a new directory:

    mkdir ~/.EVO_Kernel_sources

  • 10

    Open Nautilus. Nautilus is similar to Windows Explorer. The Home Folder is displayed. Press “Ctrl” and “H” at the same time to see hidden folders. Click on the “EVO_Kernel_sources” folder you created earlier to open it.

  • 11

    Double-click on the source file you downloaded earlier to open the TAR archive. It contains a single folder; drag this folder from the archive to the “EVO_Kernel_sources” folder to extract it there.

  • 12

    Run these commands in the Terminal to create the folder structure for the Android build and create a link to the kernel source you just extracted:

    cd ~
    mkdir android
    cd android
    mkdir sources
    cd sources
    ln -s /home/*your_user_name*/.EVO_Kernel_sources/*Extracted_folder_name kernel

    Replace “your_user_name” with your real Ubuntu username and “Extracted_folder_name” with the name of the folder you extracted from the EVO Android source archive.

  • 13

    Connect the Android phone to your Ubuntu machine in data transfer mode using the USB cable. Run these commands in the Terminal to copy the Android main configuration file from the phone to the “/android/sources/kernel” folder:

    adb pull /proc/config.gz ~/android/sources/kernel/
    cd ~/android/sources/kernel/
    gunzip config.gz

  • 14

    Run these commands to edit the makefile of the Android Kernel and specify the tool-chain and compiler:

    cd ~/android/sources
    make clean
    export ARCH=arm
    export CROSS_COMPILE=arm-eabi-
    export PATH=$PATH:~/myandroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin

  • 15

    Run this command to start configuring the kernel options:

    make menuconfig

    Scroll to the bottom of the resulting window, select the “Load an Alternative Configuration File” option and press “Enter.” Enter this path to the config file in the box that pops up:

    /home/*your-user-name*/android/sources/kernel/config

    Press “Enter” again.

  • 16

    Select the make options from the menu to edit the Android kernel. It’s best to select only the “msm7k,” “ondemand” and “performance” as processor governors in the CPU Frequency scaling section. Check the “Kernel debugging” option in the Kernel Hacking section if your build is a test build. Enable the “Support for Host-side USB” and “USB Gadget Support” if you want to use USB devices. You can also add support for various network functions, such as IP tunneling and network privacy options, in the Networking Support section.

  • 17

    Close the configuration window and select “Yes” when prompted to save it. This action creates the hidden “.config” file inside the kernel directory.

  • 18

    Run these commands in the Terminal to insert the Wi-Fi module, and make and compile your custom Android kernel:

    make
    export KERNEL_DIR=~/android/sources/kernel
    cd ~/myandroid/system/wlan/ti/sta_dk_4_0_4_32/
    make clean
    make

 

Here is a workshop in Singapore on Android Apps

Debian – The future of linux experience

The Debian Project is an association of individuals who have made common cause to create a free operating system. This operating system that we have created is called Debian.

An operating system is the set of basic programs and utilities that make your computer run. At the core of an operating system is the kernel. The kernel is the most fundamental program on the computer and does all the basic housekeeping and lets you start other programs.

Debian systems currently use the Linux kernel or the FreeBSD kernel. Linux is a piece of software started by Linus Torvalds and supported by thousands of programmers worldwide. FreeBSD is an operating system including a kernel and other software.

However, work is in progress to provide Debian for other kernels, primarily for the Hurd. The Hurd is a collection of servers that run on top of a microkernel (such as Mach) to implement different features. The Hurd is free software produced by the GNU project.

A large part of the basic tools that fill out the operating system come from the GNU project; hence the names: GNU/Linux, GNU/kFreeBSD and GNU/Hurd. These tools are also free.

Of course, the thing that people want is application software: programs to help them get what they want to do done, from editing documents to running a business to playing games to writing more software. Debian comes with over 29000 packages (precompiled software that is bundled up in a nice format for easy installation on your machine) — all of it free.

It’s a bit like a tower. At the base is the kernel. On top of that are all the basic tools. Next is all the software that you run on the computer. At the top of the tower is Debian — carefully organizing and fitting everything so it all works together.

 

Find more http://www.debian.org/

A look into Backtrack OS

BackTrack is a Linux-based penetration testing arsenal that aids security professionals in the ability to perform assessments in a purely native environment dedicated to hacking. It is aimed at digital forensics and penetration testing use. It is named after backtracking a search algorithm. The current version is BackTrack 5 R2, codenamed “Revolution and its Revision”.

BackTrack is intended for all audiences from the most savvy security professionals to early newcomers to the information security field. BackTrack promotes a quick and easy way to find and update the largest database of security tools collection to-date.Whether you’re hacking wireless, exploiting servers, performing a web application assessment, learning, or social-engineering a client, BackTrack is the one-stop-shop for all of your security needs.

BackTrack includes many well known security tools including:

  • Metasploit integration
  • RFMON Injection capable wireless drivers
  • Aircrack-NG
  • Kismet
  • Nmap
  • Ophcrack
  • Ettercap
  • Wireshark(formerly known as Ethereal)
  • BeEF (Browser Exploitation Framework)
  • Hydra
  • OWASP Mantra Security Framework collection of hacking tools, add-ons and scripts based on Firefox
  • Cisco OCS Mass Scanner: A very reliable and fast scanner for Cisco routers with telnet/enable default password.
  • A large collection of exploits as well as more commonplace software such as browsers.

BackTrack arranges tools into 12 categories:

  • Information Gathering
  • Vulnerability Assessment
  • Exploitation Tools
  • Privilege Escalation
  • Maintaining Access
  • Reverse Engineering
  • RFID Tools
  • Stress testing
  • Forensics
  • Reporting Tools
  • Services
  • Miscellaneous

If you’re making BackTrack you install BackTrack , boot it from a Live DVD or thumbdrive, the penetration distribution has been customized down to every package, kernel configuration, script and patch solely for the purpose of the penetration tester.