Extras Flashcards
mount an ISo
mount -o loop media.iso /media
Set same SELinux context for a directory
chcon -R –reference=/var/www/html/ /var/www/html/inst
FTP and http file location
vsftp server is /var/ftp/pub
HTML is /var/www/html
add/remove software tool is located
System -> administration -> add/Remove Software
List of packages needed for virtualization
qemu-kvm - the main kvm packagepython-virtinst - command line tools and libraries for creating VMS
virt-manager - GUI VM administration toolvirt-top - command for VM statisticsvirt-viewer - GUI connection to configure VMs
libvirt - c language toolkit with the libvirtd servicelibvirt-client - c language toolkit for VM client
check if the right VM modules are located
#lsmod | grep kvm output should return either kvm-intel or kvm-adm if the output is different or no output run this command to add: #modprobe kvm
virt-install
You can also use the virt-install --prompt command to set virtual machines, just enter information as asked such as RAM, CPU, and so forth # virt-install --prompt
virt-install to install a VM with a kickstart file
The virt-install –prompt command can be used to install from a kickstart. Example
# virt-install -n outside1.example.org -r 768 –dis \
path=/var/lib/libvirt/images/outsider1.example.org.img \
-l ftp://192.168.122.1/pub/inst \
-x “ks=ftp://192.168.122.1/pub/ks1.cfg”
switches for the virt-install command
- n (–name) sets the name of a VM
- r (–ram) configures the amount of RAM in MB
- -disk defins the virtual disk
- l (–location) specifies the directory or URL with the installation files
- x (–extra-args=) includes extra data, such as the url of a kickstart file.
virt-clone –prompt
the virt-clone –prompt command can be used t oclone an existing VM. Make sure the system to be cloned is shutdown.
Tools of interest for administrative purposes
- telnet and nmap to verify remove access to open ports- mutt as an email client to verify the functionality of an email server
- elinks as a web browser to make sure web services are accessible
- lftp to access ftp servers with command completion
#telnet localhost 21
# nmap localhost
#mutt -f pop://username@host
you can also use the mail command as:
$mail Michaelsubject: test
cc: marth@example.com
$mail -s ‘host file’ < /etc/hosts root@localhost
$elinks http://127.0.0.1/inst
$lftp ftp.example.org -u frany
lftp standard commands
cd - changes the current working directory at the remote host
ls - list files at the remote host
get - retrieve one file from the remote host
mget - retrieve a group of files from the remote host
put - uploads one file from your computer to remote hostmput - uploads a group of files to remote host
pwd - list current working directory to the remote host
quit - ends the FTP session
!ls - list files on your host computer in the current directory
!cd - change the local host directory fur upload/download
!pwd - list current working directory on local host computer
The Alias command examples
some alias command examples: #alias cp='cp -i' #alias l.='ls -d .* --color-=auto' #alias ll='ls -l --color=auto' #alias rm='rm -i' #alias rm ='mv -t ~/.trash'
the locate command database
the locate command database is normally updated only once each day base on this cron /etc/cron.daily/mlocate.cron (might have to manually run)
Specialized variations on the vi command:
vipw - edit /etc/passwd vigw - edit /etc/group visudo - etdit /etc/sudoers vipw -s - edit /etc/shadow vigr -s - edit /etc/gshadow
arp command
The arp command displays a table of hardware and IP addresses on the local computer. ARP can help detect problem such as duplicate addresses on the network
displaying routing table
#netstat -r -> displays routing table, similar to route #route -n -> similar to #netstat -rn
get dhcp info
dhclient eth0
two tools that can be used to configure network devices:
System-config-network -GUI
nm-connection-edit - GUI command line
System-preferences-network connections
check DNS server
if in doubt about whether the DNS server is operational: #dig @192.168.122.1 mheducation.com
default umask
The default umask is driven by the /etc/bashrc file
remount a file system
mount -o remount /home
common ports
21 - FTP 22 - secure shell (SSH) 23 - telnet 25 - SMTP 53 - DNS 80 - http 88 - kerberos 110 - pop 139 - netbios 143 - IMAP 443 - https 993 - IMAP over SSL 2049 - NFS 4995 - POP over SSL 69 - TFTP 139 & 445 as well as UDP 137 & 138 - SAMBA
diagnose error when running semanage login -l
#yum whatprovides /usr/sbin/semanage #yum -y install policycoreutils-python
options for SELinux user roles
- guest_u no GUI, no networking, no access to the SU or sudo command
- xguest_u GUI, networking only via the firefox web browser
- user_u GUI and networking available
- staff_u GUI, networking, and the sudo command available-unconfined_u Full system access
tools to search /var/log/audit
#ausearch -m avc -c sudo #sealert -a /var/log/audit/audit.log
other facl command
#getfacl file | setfacl --set-file = - file2 -> copy acl from file1 to file2 #getfacl --access dir | setfacl -d -M-dir -> copy the access acl into the default ACL