Saturday, 31 January 2015

9. Sample Test

9. Sample Test

 
Note : Please go through the parent posts 1-8 to know about this test. 
 

Q1. Create users Natasha, Harry and Sarah. Natasha and Harry should be member of secondary group admin and Sarah should not be the member. Sarah should have no interactive shell and password of all users are wakennym.

Q2. Create /common/adm. Group owner should be admin. Only admin group should have read write execute permission. Natasha and Harry should connect to /common/adm. Any file under /common/adm should have group admin.

Q3. Copy /etc/fstab to /var/tmp/fstab. Owner and group should be root. Natasha should be allowed to read and write and no one should be allowed to execute. And all others should be able to read the files. Harry should not be allowed to read or write.

Q4. Create the partition having 500 MB size and mount it in /mnt/backup.

Q5. Resize lvm from 100 MB to 300 MB

Q6. Configure swap of 700 MB

================================================================================
ANSWERS
Ans 1:  
    groupadd admin
    useradd -G admin Natasha
    passwd Natasha
    useradd -G admin Harry
    passwd Harry
    useradd -s /sbin/nologin Sarah

Ans 2:
mkdir -p /common/adm chgrp -R admin /common chmod -R 2070 /common

Ans 3:
cp -rvf /etc/fstab /var/tmp/fstab setfacl -m u:Natasha:rw /var/tmp/fstab setfacl -m u:Harry:000 /var/tmp/fstab setfacl -m u:Sarah:r /var/tmp/fstab
Ans 4: fdisk /dev/sda n 7 default +500M w mkfs -t ext4 /dev/sda7 mkdir /mnt/backup mount /dev/sda7 /mnt/backup
Ans 5: fdisk /dev/sda n 8 default +500M t 8 8e w pvcreate /dev/sda8 vgcreate VG1 /dev/sda8 lvcreate -n LV1 -l 25 VG1 mkfs.ext4 /dev/sda8 lvextend -L +200M /dev/VG1/LV1 resize2fs -p /dev/VG1/LV1
Ans 6: fdisk /dev/sda n 9 default +700M t 9 82 w mkswap /dev/sda9 swapon /dev/sda9

For any help;
noohppnoohpp@gmail.com

Tuesday, 21 October 2014

Play on Disks with Ubuntu

Play on Disks with Ubuntu


1. Partitioning of  devices using fdsik tool:

    $ fdisk -l /* Listing all partition details of all available devices */
    $ sudo fdisk /dev/sdx /* selecting fdisk tool for sdx device */
        p /* display present partitions */
        d(untill no partition exists) /* deleting existing partitions */
        n /* Creating new partitions */
        p /* selecting partiton as primary */
        1 /* giving partition number */
        (default) /* offset byte */
        (select size) /* needed partition size */
        w /* write changes */
    $ sudo mkfs.(filesystem type) /dev/sdx1 /* format the new partition as a file system type */

2. Bootable SD card without any third party:

    $ sudo mkfs.vfat -F32 /dev/sdx /* Formating the card */
    $ sudo tar -xvf ubuntu.iso /* Extracting the iso image */
    $ sudo cp -rvf ubuntu/ /SD_CardMountPoint /* Copying contents to card */
    rename isolynux folder into syslinux
    rename syslinux/isoconfig to syslinux/sysconfig

For more help click here

3. White listing icons in the display panel:

    $ gsettings set com.canonical.Unity.Panel systray-whitelist "['all']"   

4. Adding repositories and ppa's in Ubuntu:

    $ sudo add-apt-repository "deb <repository_link>"
    $ sudo add-apt-repository ppa:<ppa_name>
    $ sudo apt-get update
    $ sudo apt-get install <Package_name>

5. Checkout repository using svn:

    $ svn checkout svn://<ip_address_of_server> /* Cloning from server */
    $ sudo git clone git://github.com/<path>.git /* Cloning from git */

6. For creating symbolic links:

    $ sudo ln -sv <original_path> <link_path>

7. Compile wxWidgets programs:

    $ ./configure --disable-shared --enable-monolithic --enable-unicode --enable-debug
    $ make SHARED=0 MONOLITHIC=1 UNICODE=1 BUILD=debug
    $ sudo make install

   Cross Compiling:
   
    $ sudo ./configure --prefix=/usr/nooh/gen --exec-prefix=/usr/nooh/arm --pdfdir=/usr/nooh/pdf --x-includes=/usr/nooh/includes --x-libraries=/usr/nooh/libraries --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf  --enable-monolithic --enable-debug --disable-shared --enable-unicode --enable-webview --with-gtk  --disable-gtktest --disable-gtktest --disable-sdltest
    $ make SHARED=0 MONOLITHIC=1 UNICODE=1 BUILD=debug
    $ sudo make install

    $ cc `wx-config --cxxflags` `wx-config --libs` <program_name>
       
        or

    $ g++ -c `wx-config --cxxflags` -o hello.o hello.cpp
    $ g++ -o hello hello.o `wx-config --libs`

For more help Click here

8. Export path to linker:

    $ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<path>

9. Setting up network:

    $ sudo ifconfig eth0 <ip_address> netmask 255.255.0.0
    $ sudo mv /etc/apt/sources.list /etc/apt/sources.list.d/
    $ sudo touch /etc/apt/sources.list
    $ sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse" (forubutnu 12.04)