Notes from Fedora Linux Toolbox: 1000+ Commands for Fedora, CentOS, & Red Hat Power Users Christopher Negus 978-0470082911



Download 295.94 Kb.
Page5/5
Date01.06.2018
Size295.94 Kb.
#52434
1   2   3   4   5

Brief MySQL Notes and Links



  1. Get started with MySQL



  2. Installing Apache2 with PHP5 and MySQL Support on OpenSuse 12.2 (LAMP)



  3. Installing Apache2 with PHP5 and MySQL Support on Fedora



  4. Installing LAMP on Ubuntu for Newbies



  5. What is MySQL Configuration File



  6. Right after install root password is blank




  1. Brief Database Setup Notes (ISQS 4361)



  2. show tables;



  3. Reference Manuals

Linux RamDisk by Van Emery (see link below)
Base system is Fedora Core 9 (or any 2.4+ kernel) ls -l /dev/ram* lrwxrwxrwx 1 root root 4 Jun 12 00:31 /dev/ram -> ram1 brw-rw---- 1 root disk 1, 0 Jan 30 2003 /dev/ram0 brw-rw---- 1 root disk 1, 1 Jan 30 2003 /dev/ram1 ... dmesg | grep RAMDISK RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize RAMDISK: Compressed image found at block 0 To increase size of RamDisk edit entry in grub.conf kernel /vmlinuz-2.4.20-20.9 ro root=LABEL=/ hdc=ide-scsi ramdisk_size=16000 confirmation of success of resize is in dmesg after reboot dmesg | grep RAMDISK Format the disk mke2fs -m 0 /dev/ram0 Create the mount point and mount the disk mkdir /mnt/rd mount /dev/ram0 /mnt/rd Now verify the new ramdisk mount: mount | grep ram0 /dev/ram0 on /mnt/rd type ext2 (rw) df -h | grep ram0 /dev/ram0 16M 13K 16M 1% /mnt/rd For a detailed look at the new disk tune2fs -l /dev/ram0 Give yourself access to the disk chown van:root /mnt/rd chmod 0770 /mnt/rd ls -ald /mnt/rd drwxrwx--- 2 van root 4096 Dec 8 11:09 /mnt/rd To automate the creation every time you boot put the following into your /etc/rc.d/rc.local file # Formats, mounts, and sets permissions on my 16MB ramdisk /sbin/mke2fs -q -m 0 /dev/ram0 /bin/mount /dev/ram0 /mnt/rd /bin/chown van:root /mnt/rd /bin/chmod 0750 /mnt/rd

Other links


OtherLinks/tripwire-notes.odt

OtherLinks/Apache-2.2.6-Notes.odt

http://www.vanemery.com/Linux/Ramdisk/ramdisk.html

SELinux Notes (http://www.nsa.gov/selinux/)
Potential to compartmentalize and secure every component of a Linux system


    • processes, files, directories, users, devices etc

Instead of the all or nothing idea of root or not root you have LOTS of discretion
Mandatory Access Control (MAC) rather than Discretionary Access Control

Directories, files, etc in SELinux have many more attributes associated with them than in standard


Two different security models

    • Type Enforcement

      • All Objects are bound to a security attribute called a type

      • All process are bound to an attribute called a domain

      • Every user is allowed to access objects based on the domain in which they operate

    • Role-Based Access Control

Files:


/etc/selinux/config

      • SELINUX = (disabled, permissive, or enforcing)

      • SELINUXTYPE = (targeted, mls (multilevel security))

      • targeted limits impact an attack on a single server can have on the system

    • /etc/selinux/config/targeted

/usr/sbin/getenforce – report status

/usr/sbin/setenforce – set status


Documentation:

/usr/share/doc/selinux-doc...

/usr/share/doc/selinux-policy

--> cat /usr/share/doc/selinux-policy-3.0.8/example.fc

# myapp executable will have:

# label: system_u:object_r:myapp_exec_t

# MLS sensitivity: s0

# MCS categories:


/usr/sbin/myapp -- gen_context(system_u:object_r:myapp_exec_t,s0)
Users:

still have passwd file, root user, etc


Tools:

checkpolicy – looks at policy.conf file if found

yum install setools-gui

/usr/bin/apol

/usr/bin/seaudit

/usr/bin/sediffx

rpm -qa | grep selinux

Desktop Menu Specification

(http://www.freedesktop.org/wiki/)


Desktops

Two general types of desktop:

“heavyweight” like KDE & GNOME contain desktop & app dev. Frame.

And “plain” that only include desktop

Problem is getting everything to work together

XDG Base directory Specification

$XDG_DATA_HOME user specific data files ($HOME/.local/share)

$XDG_CONFIG_HOME user specific configuration files ($HOME/.config)

$XDG_DATA_DIRS preference-ordered set of directories to search for data files (/usr/local/share/:/usr/share)

$XDG_CONFIG_DIRS preference-ordered set of base directories to search for configuration files in addition to the $XDG_CONFIG_HOME (/etc/xdg)


/etc/xdg/user-dirs.conf

# This controls the behaviour of xdg-user-dirs-update which is run on user login

# You can also have per-user config in ~/.config/user-dirs.conf, or specify

# the XDG_CONFIG_HOME and/or XDG_CONFIG_DIRS to override this

#
enabled=True
~/.config/user-dirs.dirs (default is /etc/xdg/user-dirs.defaults)

XDG_DESKTOP_DIR="$HOME/Desktop"

XDG_DOWNLOAD_DIR="$HOME/downloads"

XDG_TEMPLATES_DIR="$HOME/Templates"

XDG_PUBLICSHARE_DIR="$HOME/Public"

XDG_DOCUMENTS_DIR="$HOME/Documents"

XDG_MUSIC_DIR="$HOME/Music"

XDG_PICTURES_DIR="$HOME/Pictures"

XDG_VIDEOS_DIR="$HOME/Videos"
File locations

$XDG_CONFIG_DIRS/menus/${XDG_MENU_PREFIX}applications.menu

XML definition of the main application menu layout

$XDG_CONFIG_DIRS/menus/applications-merged/

third parties may add new

files in this location to create their own sub-menus

$XDG_DATA_DIRS/applications/

a .desktop file for each possible menu item

$XDG_DATA_DIRS/desktop-directories/

directory entries which may be associated with folders in the menu
foo.desktop specifications

http://standards.freedesktop.org/desktop-entry-spec/latest/

look in /usr/share/applications for examples

Extensions to the desktop format above



Categories is a list of strings used to classify menu items

OnlyShowIn a list of strings identifying the environments that should display a given menu item

NotShowIn desktops that should not display an item
Example elements in kde-applications.menu



Applications

kde-unknown.directory









Core

KDE



X-Red-Hat-Base








System Settings

system-settings.menu




X-KDE-KDevelopIDE

kde-development-kdevelop.directory





Development

X-KDE-KDevelopIDE






Misc Review notes
bash scripts

example script:

#!/bin/bash

#add a -v to the line above for debugging


echo "date is $(date +%F)"

echo


dte1='date +%F'

echo "dte1=$dte1"

echo

dte2="date +%F"



echo "dte2=$dte2"

echo


dte3=$(date +%F)

echo "dte3=$dte3"

echo

dte4=`date +%A`



echo "dte4=$dte4"
results:

--> test-src/dt.sh

date is 2008-11-12
dte1=date +%F
dte2=date +%F
dte3=2008-11-12
dte4=Wednesday


    • after changing first line to #!/bin/bash -v

--> test-src/dt.sh

#!/bin/bash -v

#add a -v to the line above for debugging
echo "date is $(date +%F)"

date +%F


date is 2008-11-12

echo
dte1='date +%F'

echo "dte1=$dte1"

dte1=date +%F

echo
dte2="date +%F"

echo "dte2=$dte2"

dte2=date +%F

echo
dte3=$(date +%F)

date +%F

echo "dte3=$dte3"

dte3=2008-11-12

echo
dte4=`date +%A`

date +%A

echo "dte4=$dte4"

dte4=Wednesday
a backup bash script
#!/bin/bash
BACKUPDIR="/Gandalf/data/backup/"

ECHODATA="Backup done: "

EXCLUDES="--exclude=Recyled --exclude=recyler --exclude=. --exclude=.. --exclude='*Trash*' --exclude='temp*' --exclude='tmp*'"
#echo -e "\nMoving old backup to previous folder"

rm $BACKUPDIR/previous/*

mv $BACKUPDIR/current/* $BACKUPDIR/previous
echo

echo $BACKUPDATA/current/etc.tgz

tar -zhcf $BACKUPDIR/current/etc.tgz /etc
echo

echo $BACKUPDIR/current/boot.tgz

tar -chzf $BACKUPDIR/current/boot.tgz /boot /Gandalf/FC8/boot --exclude=/boot/boot
echo

echo partion tables

./backup_partition_tables.sh
a backup bash script for disk partitions
#!/bin/bash
BACKUPDIR="/Gandalf/data/backup/current"

echo $BACKUPDIR/MBR_Partion_Tables.tgz

dd if=/dev/sda bs=512 count=1 of=$BACKUPDIR/sda_MBR

dd if=/dev/sdb bs=512 count=1 of=$BACKUPDIR/sdb_MBR


/sbin/fdisk /dev/sda -l > $BACKUPDIR/sda_partition_table.txt

/sbin/fdisk /dev/sdb -l > $BACKUPDIR/sdb_partition_table.txt


tar -czf $BACKUPDIR/MBR_Partition_Tables.tgz $BACKUPDIR/hd* $BACKUPDIR/sd*

rm $BACKUPDIR/hd*

rm $BACKUPDIR/sd*
a file system mounting bash script (mnt)
#!/bin/bash
n=`echo $1 | tr A-Z a-z`
if [ "$0" = "/usr/local/bin/mnt" ]; then

case $n in

"kitchen" | "k" | "belinda" | "b" )

sudo mount -t cifs

'//Ariel/Easy (E)'

/Gandalf/Belinda/Easy

-o credentials=/Gandalf/Laura/configs/.what,uid=500,gid=500;;

"safe" | "s" | "encrypt" | "e" )

encfs /Gandalf/data/.safe /Gandalf/data/safe ;;
"gimli" | "g" )

sudo mount -t cifs "//192.168.1.50/media" /Gimli/media


-o credentials=/Gandalf/Laura/configs/.what,uid=500,gid=500;;

"zeus" | "z" )

sshfs drjohn@zeus:/home/durrett/Ike Gandalf/RemoteSites/Ike ;;
* )

echo "Usage: mnt WhatToMount" ;;

esac

elif [ "$0" = "/usr/local/bin/umnt" ]; then



case $n in

"kitchen" | "k" | "belinda" | "b" )

sudo umount /Gandalf/Belinda/Easy ;

"safe" | "s" | "encrypt" | "e" )

fusermount -u /Gandalf/data/safe ;;
"gimli" | "g" | "gimlidecent" | "go" | "gimliown" | "go" )

sudo umount /Gimli/media ;

"zeus" | "z" )

sudo umount /Gandalf/RemoteSites/Ike ;;

esac

fi
to unmount


ln -s mnt umnt
a bash “data” file
username=drjohn

password=sean






Download 295.94 Kb.

Share with your friends:
1   2   3   4   5




The database is protected by copyright ©ininet.org 2024
send message

    Main page