Pages

Monday, March 2, 2015

Using DVD / iso image as yum repository

# mount /dev/cdrom /media

/etc/yum.repos.d/dvd.repo

[DVD]
name=Red Hat Enterprise Linux Installation 6 x86_64
baseurl=file:///media/Server
enabled=1
gpgcheck=no

#gpgfile=file:///etc/pki/rpm-gpg/RPM-GPG-KEY*

Saturday, February 14, 2015

SSH SOCKS proxy

/etc/ssh/sshd_config file: AllowTcpForwarding yes

PuTTY

Session: hostname, port
Connection > SSH > Tunnels: Destination <port number>, Auto, Dynamic

ssh -D <proxy-port> user@host.domain

             

Sunday, January 4, 2015

[ git ] error: unable to read askpass response from '/usr/libexec/openssh/gnome-ssh-askpass'

This is common error generated after running the the command :

"$ git push -u origin master

This error can be technically ignored because git will still work; though this error is displayed.

If you don't like to see this error you can run unset SSH_ASKPASS and gnome-ssh-askpass will not be invoked and no error message will show up.

http://blog.csdn.net/lvzhuyiyi4/article/details/19564519

Saturday, August 30, 2014

Extract .deb with ar command

ar p viber.deb data.tar.gz | tar zx
https://ask.fedoraproject.org/en/question/45112/viber-on-fedora/

Wednesday, June 11, 2014

Logging all the packets dropped by iptables

# Generated by iptables-save v1.4.7 on Wed Jun 11 15:40:41 2014
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:LOGGING - [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
#-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A INPUT -m limit --limit 2/second --limit-burst 7 -j LOG --log-prefix "IPtables dropped: "
-A INPUT -j DROP
COMMIT

Sunday, May 11, 2014

RHCA - Understand and use essential tools

Use input-output redirection (>, >>, |, 2>, etc.).

Streams

standard input  - stdin  (0)
standard output - stdout (1)
standard error  - stderr (2)

$ find / -name  "*key*" 2> stderr
$ find / -name  "*key*" &> stdout_and_stderr

$ sort < file_name > sorted_file_name

Pipes

Pipes are used to redirect a stream from one program to another.


$ echo "10.128.8.143  sanbox1" | sudo tee -a /etc/hosts

Use grep and regular expressions to analyze text. 

grep, egrep, fgrep - prints lines matching a pattern. A regular expression is a special character string for describing a search pattern.

$ grep "letters"      /file/name
$ grep -r "letters"  /directory/name
$ grep -w "word"   /file/name
$ grep -v "letters"  /file/name
$ grep "^letters"   /file/name
$ grep "letters$"   /file/name
$ grep '^$'            /file/name

$ grep -E ( x | y ) /file/name
$ grep -E "(a)?b" /file/name

Access remote systems using ssh and VNC.

$ ssh sandbox01.lab -p 1022
$ ssh sandbox02.lab "ls -ltr"
$ ssh -t sandbox02.lab "screen -r"
$ ssh-copy-id sandbox02.lab

$ ssh -L 5901:localhost:5901 vnc-server.lab

$ vncviewer vnc-server:1
$ vncviewer vnc-server::501

$ ssh vnc-server
$ vncserver
$ vncviewer vnc-server <session #>

Log in and switch users in multiuser runlevels.

$ who -r
$ runlevel

/etc/inittab

        0 — Halt
        1 — Single-user text mode
        2 — Not used (user-definable)
        3 — Full multi-user text mode
        4 — Not used (user-definable)
        5 — Full multi-user graphical mode (with an X-based login screen)
        6 — Reboot

/sbin/chkconfig

su - <user name>

Archive, compress, unpack, and uncompress files using tar, star, gzip, and bzip2.


#  tar -cvf archive1.tar test-dir
echo "something" | sudo tee bar
echo "something" | sudo tee bar
echo "something" | sudo tee bar
echo "something" | sudo tee barecho "something" | sudo tee bar
echo "something" | sudo tee bar