Thursday, January 14, 2016

Web Server having permission denied

When accessing a webpage and having permission denied is a pain in the arse~!

So what do we do???

Well, the way to cheat is just to disable selinux

  • Terminal# vi /etc/selinux/config
    • SELINUX=disabled
  • Reboot and volla~ webpage access permitted~

Bash Script

Bash Script arguments are as follows:

  1. First Argument: $1
  2. Second Argument: $2
  3. Third Argument: $3

Example:

  • Terminal# ./script alpha bravo charlie
  • Variables: $1=='alpha'; $2=='bravo'; $3=='charlie'

Script Example

#!/bin/bash
echo "the $1 eats a $2 every time there is a $3"
echo "bye =)"

  • Terminal# ./script dog bone moose
  • Output: the dog eats a bone every time there is a moose
    bye =)



Reference

http://how-to.wikia.com/wiki/How_to_read_command_line_arguments_in_a_bash_script

Set and empty wpa_passphrase for hostapd.conf

The setting and empty wpa_passphrase is done. Now need to beautify it. Refer to NetCrypt Mobile Folder.

Linux sed replace

sed -i.bkp 5'i'"s/search/replace/" inputfile

  • -i.bkp take backup as inputfile.bkp and edit original file
  • 5'i' go to line 5
  • s/ search and replace
also can search specific word say 'NAME' and in same line search 'RAM' and replace with 'SHYAM'

sed -e '/NAME/s/RAM/SHYAM/g' filename



Reference

http://unix.stackexchange.com/questions/65064/how-to-find-and-replace-a-particular-string-in-a-specific-line

Linux: grep, sed

Find a line and append strings

  1. "grep" allows to find lines that contains the string/characters
  2. "sed" allows to append string/characters
$sed '/3696/ s/$/running file.txt'
foo1 3464
foo2 3696 running
foo3 4562
$sed 's/3696/& running/' file.txt
foo1 3464
foo2 3696 running
foo3 4562
P.S. Add the -i option to save the changes back to file.txt

Reference

http://stackoverflow.com/questions/14051883/how-to-append-text-to-a-specific-lines-in-a-file-using-shell-script

Fedora 21 Web Server for other connected devices

Although localhost, "127.0.0.1", can access on the local machine. Other connected devices will not be able to access to localhost web server.

The thing to lookout for is, FIREWALL~!


  1. Terminal# firewall-cmd --zone=public --add-port=80/tcp --permanent
    • Adding port 80 to public zone permanently~
  2. Terminal# firewall-cmd --reload
    • Reload the firewalld.service for rule to take effect
  3. Terminal# iptables-save|grep 80
    • Shows "-A IN_FedoraWorkstation_allow -p tcp -m tcp --dport 80 -m conntrack --ctstateNEW -j ACCEPT"
  4. Terminal# iptables -L|grep http
    • Shows "tcp -- anywhere tcp dpt:http ctstate NEW"

No GUI, kernel message flooding and installation of httpd

This input will be on:

  1. Remove GUI boot aka the graphical boot
  2. Remove excessive kernel messages from flooding the screen at login
  3. Installation of httpd essentials

For non-graphical boot

Terminal# systemctl set-default multi-user.target

OR

Terminal# systemctl set-default -f multi-user.target
// with --force

Double check the configured settings

Terminal# systemctl get-deafult

OR

Terminal# systemd.unit=multi-user.target

For stopping kernel message flooding

Terminal# sysctl -w kernel.printk="2 4 1 7"
//output
kernel.printk = 2 4 1 7
Terminal# sysctl kernel.printk
//output
kernel.printk = 2 4 1 7

Reference code:
                               CUR    DEF    MIN    BTDEF
0 - emergency
1 - alert
2 - critical
3 - error
4 - warning
5 - notice
6 - informational
7 - debug

For the installation of Apache 2 with PHP5 and MySQL support

//Installing MySQL/MariaDB5
Terminal# yum install mariadb mariadb-server

//Installing Apache 2
Terminal# yum install httpd

//Installing PHP5
Terminal# yum install php

//MySQL support in PHP5
Terminal# yum install php-mysqlnd php-mssql php-opcache

//Install phpMyAdmin

Fresh Installation of Fedora 21

Pissed off with the current situation with the Fedora 21 on my workstation; always showing this "rtl_usb ... request timeout", I have decided to delete the image and reinstall a fresh new setup.

This time round, I better journal down all the changes I am gonna make to keep track on the progress.


Sign off, R

Friday, January 8, 2016

Thursday, January 7, 2016

VirtualBox USB Devices not available

When host, Linux Distro, and GuestOS is also, Linux Distro, check for group.


  1. Terminal# vi /etc/group
    • Look for vboxusers
  2. Terminal# sudo usermod -G vboxusers -a $USER
    • $USER is the host
  3. Reboot host then open virtualbox to verify result

Reference:

http://askubuntu.com/questions/140081/virtualbox-doesnt-recognize-usb