Wednesday, November 27, 2013

How to root your SGH-T999

Links to needed files
Download the files linked below
Odin3_V3.09 downloader link
USB Driver Link
Grab the original T999UVUEMJC stock firmware:
CF-Auto-Root for Galaxy S3 (T-Mobile) SGH-T999

Power off phone
Boot phone to download mode
Use Odin 3 to install 4.3 stock ROM
Phone will reboot when complete

After 1st boot power off phone
Boot phone back in to download mode
Use Odin to install CF-Auto-Root
Phone will reboot when complete

When Phone is back up and running after 1st boot
Enable SuperSU in Settings/More/Application Manager
Go to Google Play
Apply update for SuperSU

If not showing up, Install from Google Play

Open up SuperSU
Allow app to update/Allow app to disable KNOX
Wait patiently for a few minutes
Reboot device

You now have root

Thursday, May 9, 2013

RHEL 6 iSCSI setup

Here is a mini howto for setting up RHEL 6 to share iSCSI storage.


A note of advice:
Whatever device you setup to be shared out as an iSCSI device, must not be mounted on the server. If it is mounted, you will not see it when you run the command tgt-admin –show!

Server steps used:
  1. yum install scsi-target-utils perl-Config-General
  1. service tgtd start
  2. chkconfig tgtd on
  3. add the following lines to /etc/tgt/targets.conf

<target iqn.2012-05.com.example.server1:data>
backing-store /dev/sdb1   #LUN1
write-cache off
</target>

  1. service tgtd restart
  2. tgt-admin –show
you should see output similar to the following
 
Target 1: iqn.2011-07.com.example.server1:trial
  System information:
  Driver: iscsi
  State: ready
  I_T nexus information:
  LUN information:
  LUN: 0
      Type: controller
      SCSI ID: IET     00010000
      SCSI SN: beaf10
      Size: 0 MB
      Online: Yes
      Removable media: No
      Backing store type: rdwr
      Backing store path: None
  LUN: 1
      Type: disk
      SCSI ID: IET     00010001
      SCSI SN: beaf11
      Size: 20000 MB
      Online: Yes
      Removable media: No
      Backing store type: rdwr
      Backing store path: /dev/sdb1

To mount the newly create iSCSI luns on the client follow these steps on the client:
  1. yum install iscsi-initiator-utils
  2. service iscsid start
  1. chkconfig iscsid on
  1. run the following commands to discover and connect to the lun on the server
    1. iscsiadm –mode discovery –type sendtargets –portal 192.168.1.10
      1. you will see output similar to the following:
      1. 192.168.1.10:3260,1 iqn.2012-05.com.example.server1:data
    1. iscsiadm –m node –T iqn.2012-05.com.example.server1:data –p 192.168.1.10 –l
      1. Logging in to [iface: default, target: iqn.2012-05.com.example.server1:data, portal: 192.168.1.10,3260]
  1. You should now see a new device listed in fdisk. Something along the lines of /dev/sdb1 if you only have 1 hdd in the server
  1. You are now ready to mount /dev/sdb1
  1. To mount the filesystem run the following commands:
    1. mkdir /data
    1. mount /dev/sdb1 /data
  1. If you want to make the mount point persistant, add the following line to /etc/fstab:
    1. /dev/sdb1           /data     ext4       defaults               0 0

How to create a local RHEL/CentOS repo


Here are the steps you need to create a local repo using the installation media for RHEL/CentOS.

insert cd in to optical drive
mount /dev/cdrom /media
cp -uRav /media/* /repo
once complete modify /etc/yum.repos.d/rhel.repo
vi /etc/yum.repos.d/rhel.repo
insert the following text into the file
[rhel]
name=rhel repo
baseurl=file:///repo
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

save changes and exit
run the following commands
yum clean all
yum list available

Change SSH Welcome Banner on Ubuntu


Change SSH Welcome Banner on Ubuntu


Every time I connect to my Ubuntu development server through my ssh client, I receive the same message and I’m getting tired of seeing it, so I decided to change the message to something else.
Here’s the message that I get every time:
Welcome to Ubuntu 13.04 (GNU/Linux 3.8.0-19-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Thu May  9 07:37:21 CDT 2013

  System load:  0.01               Processes:           88
  Usage of /:   17.4% of 14.64GB   Users logged in:     0
  Memory usage: 34%                IP address for eth0: 10.14.186.85
  Swap usage:   0%

  Graph this data and manage this system at https://landscape.canonical.com/

0 packages can be updated.
0 updates are security updates.

New release '13.04' available.
Run 'do-release-upgrade' to upgrade to it.


Last login: Mon Aug 13 01:05:46 2007 from ipaddress removed
root@test:~$
Changing this message requires editing two different files. The first three sections can be modified by editing the following file:
/etc/motd
This file contains the linux build number as well as the Ubuntu warranty message. I don’t find this particularly useful, so I removed all of it and replaced it with my own message.
To disable the last login message (which I don’t recommend doing), you will need to edit the following file in sudo mode:
/etc/ssh/sshd_config
Find this line in the file and change the yes to no as shown:
PrintLastLog no
Now when you login, you’ll get a blank prompt, although I wouldn’t necessarily recommend it because it’s useful to see the last login to the system for security reasons. This is my prompt now:
Welcome to Ubuntu 13.04 (GNU/Linux 3.8.0-19-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Thu May  9 07:37:21 CDT 2013

  System load:  0.01               Processes:           88
  Usage of /:   17.4% of 14.64GB   Users logged in:     0
  Memory usage: 34%                IP address for eth0: 10.14.186.85
  Swap usage:   0%

  Graph this data and manage this system at https://landscape.canonical.com/


root@test:~$
Linux is really great.

Tuesday, June 26, 2012

Command to find current Ubuntu Version



This can be handy to make sure that you had a complete update if you just recently tried to update to 12.04
Run this command to find the installed version of Ubuntu…

cat /etc/lsb-release

You will end up with output similar to the output below.

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04 LTS"

Saturday, April 14, 2012

Tasker for Android

Tasker for Android:

An amazing way to automate tasks on your android phone. I use it to enable bluetooth and start the music app while driving.

'via Blog this'

Thursday, March 1, 2012

RHCE

I just spent the last several weeks studying for my RHCE.
It was a long process, I learned a lot, but most importantly, I achieved my RHCSA and my RHCE.
So in the interest of sharing knowledge, I would like to share my notes.
While I did use these notes to pass, I do not in any claim that they are complete or completely correct.
If you find something in here that isn't correct, let me know and I will make the appropriate adjustment.
If you find this useful, drop me a note and let me know.
Here is the method I used to study:
I went to Red Hat's website, found here:http://www.redhat.com/training/courses/ex300/examobjective and here: http://www.redhat.com/training/courses/ex200/examobjective.
I made a list of all of the objectives in a text document, and then under each objective I listed out all of the steps needed to complete each objective.
So, here is what I have, and I do hope that you find it useful.
RHCE Study Notes

System Configuration and Management

 
chkconfig service on
service service start/stop/restart
system-config-firewall
backup config files before editing
chcon -t folder_context /path
getsebool -a | grep nfs
setsebool -P bool_ean
 

• Route IP traffic and create static routes
• /etc/sysconfig/network-scripts/route-eth?
default 192.168.0.1 dev eth0
10.10.10.0/24 via 192.168.0.1 dev eth0
172.16.1.0/24 via 192.168.0.1 dev eth0
• or you can use this format
ADDRESS0=10.10.10.0
NETMASK0=255.255.255.0
GATEWAY0=192.168.0.1
ADDRESS1=172.16.1.0
NETMASK1=255.255.255.0
GATEWAY1=192.168.0.1
 

• Use iptables to implement packet filtering and configure network address translation (NAT)
• chkconfig iptables on
• service iptables start
• system-config-firewall
• /etc/sysconfig/iptables
[backup this file before modifying]

• Use /proc/sys and sysctl to modify and set kernel run-time parameters
• echo value > /proc/file
• echo 1 > /proc/sys/net/ipv4/ip_forward
• nano /proc/sys/net/ipv4/ip_forward
• make changes go into effect = sysctl -p
[recommend backing up /etc/sysctl.conf before modifying]

 

• Configure system to authenticate using Kerberos
• system-config-authentication from within gui
authconfig-tui in cli

 
• Configure a system as an iSCSI initiator that persistently mounts an iSCSI target
yum install iscsi-initator-utils
• iscsiadm -m discovery -t st -p 172.26.0.1
• chkconfig iscsi on
• service iscsi start
iscsiadm -m node -T iqn.2012.01.com.example.server1:iscsi -p 172.26.0.1
iscsiadm -m node -T iqn.2012.01.com.example.server1:iscsi -p 172.26.0.1 -l
to make a static iscsi connection modify /etc/iscsi/initiatorname.iscs
you are then free to fdisk, format, mount and use the newly discovered "sd" devices
[add _netdev_ to any iSCSI or NFS partitions if being added to /etc/fstab, to prevent maintenance mode from halting on you]

 

• Produce and deliver reports on system utilization (processor, memory, disk, and network)
top
iostat
free
mem
ethtool
dstat
tcpdump
sar


• Use shell scripting to automate system maintenance tasks
#!/bin/bash
full/path/to/command
create cron job using script you just created
putting in variables into crontab such as “MAILTO=” or “PATH=” simplifies things.

• Configure a system to log to a remote system
/etc/rsyslog.conf *.* 172.26.0.1:514

• Configure a system to accept logging from a remote system
/etc/rsyslog.conf
uncomment the 2 following lines
$ModLoad imtcp.so
$InputTCPServerRun 514
open up port 514 tcp in iptables

Network Services Network services are an important subset of the exam objectives. RHCE candidates should
be capable of meeting the following objectives for each of the network services listed below:
• Install the packages needed to provide the service
• Configure SELinux to support the service
• Configure the service to start when the system is booted
• Configure the service for basic operation
• Configure host-based and user-based security for the service RHCE candidates should also be
capable of meeting the following objectives associated with specific services:
 

HTTP/HTTPS
• Configure a virtual host
yum groupinstall web-server -y
chkconfig httpd on
service httpd start
open up proper ports for iptables
nano -w /etc/httpd/conf/httpd.conf
ServerName station1.example.com:80
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@station1.example.com
DocumentRoot /var/www/html
ServerName station1.example.com
# Default web server
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@station1.com
DocumentRoot /www/docs/station1
 
ServerName station1.com
# Virtual web server
</VirtualHost>
mkdir -p /www/docs/station1
chcon -R --reference /var/www/html /www
service httpd restart
 
• Configure private directories
find this section in httpd.conf
<Directory "/var/www/html/chapter">
</Directory>
below the section - add this section to it
<Directory "/var/www/html/chapter">
AuthType Basic
AuthName "Password Protected Test"
AuthUserFile /etc/httpd/testpass
Require user testuser
</Directory>
save and exit
create a user to test
useradd testuser
then add the httpd password
htpasswd -c /etc/httpd/testpass testuser
 
restart httpd
test with httpd -t or httpd -S
 
connect with a browser to test
tip: su – to the apache user to test if the daemon can get into directories
 
• Deploy a basic CGI application
in /etc/httpd/conf/httpd.conf make sure cgi_module is loaded
should be enabled by default
modify <Directory> container for cgi add the 2 lines
Options ExecCGI
AddHandler cgi-script .pl
 
create basic cgi script hello.pl
#!/usr/bin/perl
print "Content-type; text/html\n\n";
print "hello, world!";
 
chmod 755 hello.pl
works for bash scripts too… not sure if you knew. I call it, my “LAMB” server.
connect from browser
elinks station1.example.com/cgi-bin/hello.pl

 
• Configure group-managed content
similar to above objective, only for a group instead of a specific user
 
*****************************************
 
DNS
• Configure a caching-only name server
yum install bind bind-chroot
chkconfig named on
service named start
iptables rules for port 53
 
• Configure a caching-only name server to forward DNS queries
modify /etc/named.conf lines
listen-on port 53 { 127.0.0.1; 172.26.0.201; };
allow-query { localhost; 172.26.0.0/24; };
forward only;
forwarders {
172.26.0.1;
};
 
FTP
• Configure anonymous-only download
yum install vsftpd
chkconfig vsftpd on
iptables rules for port 21
nano /etc/vsftpd/vsftpd.conf
comment out local_enable=yes
setsebool -P allow_ftpd_full_access
 
NFS
• Provide network shares to specific clients
yum groupinstall nfs-file-server
chkconfig nfs on
nano /etc/sysconfig/nfs
RQUOTAD_PORT=4000
LOCKD_TCPPORT=4001
LOCKD_UDPPORT=4001
MOUNTD_PORT=4002
STATD_PORT=4003
config iptables rules for nfs4 ports 111/tcp/udp 2049/udp
nano -w /etc/exports
/share *(rw,sync)
 
exportfs to show nfs exports
setsebool -P nfs_export_all_rw on
 
• Provide network shares suitable for group collaboration
*************need assistance with this one***********************
 
SMB
• Provide network shares to specific clients
yum groupinstall cifs-file-server -y
chkconfig smb on
iptables rules for samba
service smb start
nano -w /etc/samba/smb.conf
setsebool -P samba_export_all_rw on
chcon -t samba_share_t /path
use the examples at the bottom of the config file to set up the shares
smbclient and testparm
• Provide network shares suitable for group collaboration
same as above - except set permissions for a group
 
 
SMTP
• Configure a mail transfer agent (MTA) to accept inbound email from other systems
yum install postfix
chkconfig postfix on
service postfix start
nano -w /etc/postfix/main.cf
adjust the following lines
myhostname = station1.example.com
mydomain = example.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost
mynetworks = 172.26.0.0/24, 127.0.0.0/8
 
check syntaxt with postfix check
service postfix restart
iptables rules for smtp = port 25
 
• Configure an MTA to forward (relay) email through a smart host
/etc/postfix/main.cf
change this directive
relayhost = outsider1.example.com
 
SSH
• Configure key-based authentication
ssh-keygen - follow prompts
ssh-copy-id 172.26.0.1
 
• Configure additional options described in documentation
nano -w /etc/ssh/sshd_config
 
**************************************************************************
 
RHCSA OBjectives Understand and Use Essential Tools
 
• Access a shell prompt and issue commands with correct syntax
ls, mv, cp
 
• Use input-output redirection (>, >>, |, 2>, etc.)
cat file1 >> file2
cat file1 | les
 
• Use grep and regular expressions to analyze text
cat file1 | grep -i string
one of my favorites: grep –v for inverse selection
 
• Access remote systems using ssh and VNC
ssh user@172.26.0.1
 
• Log in and switch users in multi-user runlevels
su -
init 3
init 5
/etc/inittab for default run level
 
• Archive, compress, unpack and uncompress files using tar, star, gzip, and bzip2
gzip big.jpg
gzip -d big.jpg.gz
 
bzip2 big.jpg
bzip2 -d big.jpg.bz2
 
tar czvf home.tar.gz /home
tar xzvf home.tar.gz /home
 
• Create and edit text files
touch file1
nano file1
vi file1
 
• Create, delete, copy and move files and directories
mkdir test
rmdir test
rm -rf test
mv file1 /path/test/
pushd and popd, useful for scripting (or hunting around directories like a mad man)



• Create hard and soft links
ln file1 file2
ln -s file1 file2
 
• List, set and change standard ugo/rwx permissions
chown
chmod
 
• Locate, read and use system documentation including man, info, and files in /usr/share/doc . [Note:
Red Hat may use applications during the exam that are not included in Red Hat Enterprise Linux for
the purpose of evaluating candidate's abilities to meet this objective.]
man command
man 5 command
rpm –qd, -qc, -qi these get me out of binds a lot

Operate Running Systems • Boot, reboot, and shut down a system normally
shutdown -h now
reboot
shutdown -r now
 
• Boot systems into different runlevels manually
modify grub kernel string - S 1 3 at end of line
 
• Use single-user mode to gain access to a system
modify grub kernel line during boot = add S to end of line
 
• Identify CPU/memory intensive processes, adjust process priority with renice, and kill processes
top
ps
nice
 
 
• Locate and interpret system log files
/var/log/messages
 
• Access a virtual machine's console
virt-manager
 
• Start and stop virtual machines
virsh list all
virsh start "vm"
virsh destroy "vm"
 
• Start, stop and check the status of network services Configure Local Storage
service service stop/start/restart
 
• List, create, delete and set partition type for primary, extended, and logical partitions
fdisk
parted
 
• Create and remove physical volumes, assign physical volumes to volume groups, create and delete logical volumes
pvcreate/pvdisplay/pvremove/pvextend
lvcreate/lvdisplay/lvextend/lvremove
vgcreate/vgdisplay/vgextend/vgremove
 
• Create and configure LUKS-encrypted partitions and logical volumes to prompt for password and mount a decrypted file system at boot
create a partition
dd if=/dev/urandom of=/dev/sdb1
cryptsetup --verbose --verify-passphrase luksFormat /dev/sdb1
cryptsetup luksOpen /dev/sdb1 opt_data
make sure encrypted partition exists
ls -l /dev/mapper | grep opt_data
format the new filesystem
mkfs.ext4 /dev/mapper/opt_data
create mount point and mount newly formatted filesystem
mkdir /opt/opt_data
mount /dev/mapper/opt_data /opt/opt_data
nano /etc/crypttab --> add the following line
opt_data /dev/sdb1 none
add the following line to /etc/fstab
/dev/mapper/opt_data                /opt/opt_data  ext4       defaults               1 2
restore selinux contexts
restorecon -v -R /opt/opt_data
reboot and use the following commands to test
cryptsetup luksDump /dev/sdb1
 
• Configure systems to mount file systems at boot by Universally Unique ID (UUID) or label
dumpe2fs /dev/mapper/opt_data | grep -i uuid
/etc/fstab
UUID=uuid of drive
 
• Add new partitions, logical volumes and swap to a system non-destructively Create and Configure File Systems
fdisk
mkswap
swapon
 
• Create, mount, unmount and use ext2, ext3 and ext4 file systems
fdisk
mkfs.ext?
mount /dev/sd? /mnt/point
umount /mnt/point
 
• Mount, unmount and use LUKS-encrypted file systems
mount, umount
 
• Mount and unmount CIFS and NFS network file systems
mount -t cifs //server1.example.com/share /mnt/point
 
• Configure systems to mount ext4, LUKS-encrypted and network file systems automatically
add appropriate mount info to /etc/fstab
 
• Extend existing unencrypted ext4-formatted logical volumes
cryptsetup resize /dev/mapper/opt_data
 
• Create and configure set-GID directories for collaboration
????
 
• Create and manage Access Control Lists (ACLs)
add "acl" to proper line in /etc/fstab
getfacl
setfacl
 
 
• Diagnose and correct file permission problems
chmod
chown
 
Deploy, Configure and Maintain Systems
 
• Configure networking and hostname resolution statically or dynamically
system-config-network
/etc/resolve.conf
/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-eth0
 
• Schedule tasks using cron
crontab -e
 
• Configure systems to boot into a specific runlevel automatically
/etc/inittab
 
• Install Red Hat Enterprise Linux automatically using Kickstart
during boot up
ks=floppy
 
 
• Configure a physical machine to host virtual guests
yum install python-virtinst libvirt virt-manager libvert-client
 
• Install Red Hat Enterprise Linux systems as virtual guests
virt-install –-name Client03 –-ram 512 –-disk
path=/var/lib/libvirt/images/client03.img,size=8 –-network network=default –-
cdrom /dev/cdrom
 
 
• Configure systems to launch virtual machines at boot
virsh autostart station.example.com
 
• Configure network services to start automatically at boot
chkconfig service on
 
• Configure a system to run a default configuration HTTP server
yum install @web-server
 
• Configure a system to run a default configuration FTP server
yum install vsftpd
 
• Install and update software packages from Red Hat Network, a remote repository, or from the local filesystem
yum install
/etc/yum.repos.d/name.repo
 
• Update the kernel package appropriately to ensure a bootable system
rpm -U kernel.rpm
yum install kernel
 
• Modify the system bootloader
grub-install
nano /boot/grub/menu.lst
 
• Configure a system to run a default configuration NTP server and synchronize time using other NTP peers
chkconfig ntpd on
service ntpd start
nano -w /etc/ntp.conf
add peer
open up port in firewall
port 123 tcp/udp
 
Manage Users and Groups
 
• Create, delete, and modify local user accounts
useradd
usermod
userdel
 
• Change passwords and adjust password aging for local user accounts
passwd username
chage
 
• Create, delete and modify local groups and group memberships
groupadd -G number name
chgrp
usermod -aG user group
 
• Configure a system to use an existing LDAP directory service for user and group information
authconfig-tui
 
Manage Security
 
• Configure firewall settings using system-config-firewall or iptables
system-config-firewall
nano -w /etc/sysconfig/iptables
 
• Set enforcing and permissive modes for SELinux
setenforce
getenforce
 
• List and identify SELinux file and process context
ls -lZ /path
 
• Restore default file contexts
restorecon /path
 
• Use boolean settings to modify system SELinux settings
getsebool -a | grep nfs
setsebool -P nfs_export_all_rw on
 
• Diagnose and address routine SELinux policy violations
tail /var/log/secure
tail /var/log/messages
 
RHCSA Study Guide


RHCSA Exam Objectives
Understand and Use Essential Tools

Access a shell prompt and issue commands with correct syntax

• Use /bin/sh -or- /bin/bash

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

• stdout to file (>)
• stderr to file (2>)
• append to file (>>)
• stderr to stdout (2>&1)
• ex. iptables -L -n -v -x >> /tmp/ipt.out 2>&1 — redirect stdin and stdout to /tmp/ipt.out

Use grep and regular expressions to analyze text

• grep expr -or- egrep expr
• ex. tail -f /var/log/messages | egrep ‘(kernel|error)’ — only show lines containing kernel or error strings
• ex. cat /etc/httpd/conf/httpd.conf | grep -v ‘^#’ — omit lines starting with # character

Access remote systems using ssh and VNC

• SSH:
• ssh user@host
• VNC:
• vncviewer host:display
• vncviewer host::port

Log in and switch users in multi-user runlevels

• su – user

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

• Compress:
• tar cfz archive.tar.gz infile1 infile2
• ex. tar cfz /tmp/httpd_conf.tar.gz /etc/httpd
• Uncompress:
• tar xfz archive.tar.gz
• The rest of the commands are similar. Use –help and read their man page

Create and edit text files

• vim file -or- nano file

Create, delete, copy and move files and directories

• Create/touch: touch file
• ex. touch /tmp/i_was_here
• Move/rename: mv srcfile dstfile
• ex. mv /home/john/httpd.conf /etc/httpd/conf/httpd.conf
• Remove: rm file
• ex. rm /home/john/httpd.conf.old
• Copy: cp srcfile dstfile
• ex. cp httpd.conf httpd.conf.backup

Create hard and soft links

• Soft link: ln -s srcfile dstlink
• ex. ln -s /mnt/data/docs /home/john/Desktop/documents — soft link from /mnt/data/docs to Desktop
• Hard link: ln srcfile dstlink

List, set and change standard ugo/rwx permissions

• List: ls -l
• Change: chmod mode file
• ex.
• chmod u=rwx,g=rx,o=rx myscript.sh
• chmod 755 myscript.sh
• (755 is equivalent to u=rwx,g=rx,o=rx)

Locate, read and use system documentation including man, info, and files in /usr/share/doc

• apropos keyword
• whatis keyword
• man -k keyword
• man command
• info command
• fgrep -Ri keyword /usr/share/doc/package
Red Hat may use applications during the exam that are not included in Red Hat Enterprise Linux for the purpose of evaluating candidate’s abilities to meet this objective.

Operate Running Systems
Boot, reboot, and shut down a system normally

• reboot
• shutdown -h now

Boot systems into different runlevels manually

• append 1 up to 5 to kernel boot options (press e in grub menu to edit a line)

Use single-user mode to gain access to a system

• append 1 to kernel boot options (press e in grub menu to edit a line)

Identify CPU/memory intensive processes, adjust process priority with renice, and kill processes

• Identify: top (use shift-f to select sort column)
• Adjust priority: renice -20|0|20 pid
• Kill: kill -9 pid -or- killall -9 name -or- pkill -f expr

Locate and interpret system log files

• Look for logs in /var/log/.
• /var/log/messages file is an important system log!

Access a virtual machine’s console

• virt-manager
• OR virt-viewer
• OR:
1. virsh vncdisplay domain
2. vncviewer localhost:display

Start and stop virtual machines

• virt-manager
• OR:
1. virsh start domain
2. virsh shutdown domain

Start, stop and check the status of network services

• service service_name stop
• service service_name start
• service service_name status
• ex. service httpd stop – stop http server

Configure Local Storage
List, create, delete and set partition type for primary, extended, and logical partitions

• List: fdisk -l
• Modify: cfdisk device -or- fdisk device -or- parted

Create and remove physical volumes, assign physical volumes to volume groups, create and delete logical volumes

• Physical volumes:
• pvcreate –help
• pvremove –help
• Volume groups:
• vgcreate –help
• vgremove –help
• Logical volumes:
• lvcreate –help
• lvremove –help

Create and configure LUKS-encrypted partitions and logical volumes to prompt for password and mount a decrypted file system at boot

1. cryptsetup luksFormat device
2. cryptsetup luksOpen device mappername
3. mkfs.fs mappername
4. edit /etc/crypttab: mappername device none
1. (/etc/crypttab: use UUID or LABEL for device)
5. edit /etc/fstab: /dev/mapper/mappername /mpoint (…)

Configure systems to mount file systems at boot by Universally Unique ID (UUID) or label

• Find a device’s UUID or LABEL:
• blkid device
• OR ls -l /dev/disk/by-* | grep device
• Edit /etc/fstab:
• use LABEL=label or UUID=uuid to specify the device

Add new partitions, logical volumes and swap to a system non-destructively

• Create a partition:
• cfdisk device -or- fdisk device -or- parted
• Create a logical volume:
• lvcreate –help
• Add swap:
1. mkswap device
2. swapon device

Create and Configure File Systems
Create, mount, unmount and use ext2, ext3 and ext4 file systems

• Create: mkfs.extfs
• Mount: mount device /mpoint
• Unmount: umount device

Mount, unmount and use LUKS-encrypted file systems

1. cryptsetup luksOpen device mappername
2. mount /dev/mapper/mappername /mpoint
3. umount /dev/mapper/mappername
4. cryptsetup luksClose mappername

Mount and unmount CIFS and NFS network file systems

• Mount:
• NFS: mount -t nfs host:/share /mpoint
• CIFS: mount -t cifs -o “username=,password=” //host/share /mpoint
• Unmount: umount /mpoint

Configure systems to mount ext4, LUKS-encrypted and network file systems automatically

• Configure /etc/auto.*:
• nfs: mpoint -rw,intr host:/remote/mpoint
• device: mpoint -fstype=fstype :device

Extend existing unencrypted ext4-formatted logical volumes

• lvresize –help -or- lvextend –help
• ex. lvresize -L+1G lv — add 1G to lv

Create and configure set-GID directories for collaboration

1. chmod g+s dir
2. create group shared_grp
3. chgrp shared_grp dir
4. Add users to shared_grp

Create and manage Access Control Lists (ACLs)

• View acl: getfacl file
• Modify: setfacl -m mode file
• ex. setfacl -m u:john:rw /home/anna/prv_file
• Remove: setfacl -x mode file

Diagnose and correct file permission problems

• Diagnose:
• ls -laZ
• getfacl file
• check /var/log/audit/audit.log for selinux errors
• Fix:
• chmod mode file
• setfacl -m mode file

Deploy, Configure and Maintain Systems
Configure networking and hostname resolution statically or dynamically

• Create static hostnames: /etc/hosts
• Configure dns servers: /etc/resolv.conf
• Manage resolution order: /etc/nsswitch.conf

Schedule tasks using cron

• crontab -e
• OR edit /etc/cron.*/file:
• ex. vim /etc/cron.daily/mycron

Configure systems to boot into a specific runlevel automatically

• Edit /etc/inittab and modify initdefault with values from 1..5

Install Red Hat Enterprise Linux automatically using Kickstart

• Use kernel boot options:
• linux ks=ftp/http://host/ks.cfg
• linux ks=nfs:host:/ks.cfg
• linux ks=cdrom:/dev/dir/ks.cfg
• linux ks=hd:/dev/dir/ks.cfg
• linux ks=file:/dev/dir/ks.cfg

Configure a physical machine to host virtual guests

• Use virt-manager

Install Red Hat Enterprise Linux systems as virtual guests

• Use virt-manager

Configure systems to launch virtual machines at boot

• Use virt-manager -or- virsh autostart domain

Configure network services to start automatically at boot

• Configure: chkconfig service on -or- ntsysv
• View startup services: chkconfig –list

Configure a system to run a default configuration HTTP server

1. yum install httpd
2. service httpd start
3. chkconfig httpd on
4. update /etc/sysconfig/iptables (open port tcp 80)

Configure a system to run a default configuration FTP server

1. yum install vsftpd
2. service vsftpd start
3. chkconfig vsftpd on
4. update /etc/sysconfig/iptables (open port tcp 21)

Install and update software packages from Red Hat Network, a remote repository, or from the local filesystem

• yum search name
• yum install package
• yum update package

Update the kernel package appropriately to ensure a bootable system

• rpm -ivh new_kernel.rpm
• OR yum install kernel

Modify the system bootloader

• Edit /boot/grub/grub.conf

Manage Users and Groups
Create, delete, and modify local user accounts

• Add: useradd
• Delete: userdel
• Modify: usermod
• View /etc/passwd

Change passwords and adjust password aging for local user accounts

• Change password: passwd user
• Change aging: chage -E YYYY-MM-DD user

Create, delete and modify local groups and group memberships

• Add: groupadd
• Delete: groupdel
• Modify: groupmod
• Memberships: edit /etc/group

Configure a system to use an existing LDAP directory service for user and group information

• Use system-config-authentication

Manage Security
Configure firewall settings using system-config-firewall or iptables

• Insert: iptables -t TABLE -I CHAIN …
• Append: iptables -t TABLE -A CHAIN …
• Delete: iptables -t TABLE -D CHAIN …
• Flush table: iptables -t TABLE -F
• Save persistent changes to /etc/sysconfig/iptables

Set enforcing and permissive modes for SELinux

• Persistent change:
• /etc/selinux/config:
• SELINUX=enforcing|permissiveCurrent session:
• Non persistent change:
• setenforce 1|0|enforcing|permissive

View SELinux status:

• Sestatus

List and identify SELinux file and process context

• ls -lZ
• ps -efZ

Restore default file contexts

• restorecon -R file

Use boolean settings to modify system SELinux settings

• View booleans:
• getsebool -a | grep keyword
• OR semanage boolean -l | grep keyword
• Change booleans:
• setsebool -P boolean on|off

Diagnose and address routine SELinux Policy violations

• Diagnose:
• /var/log/audit/audit.log
• /var/log/messages
• view service logs
• sealert
• Fix:
• audit2allow
• setsebool -P boolean on|off