skimppimppin along! NEWS   FORUM   DOWNLOAD   LINKS    
HOME ACCOUNT PRIVATE MESSAGE  
Login
Username:

Password:


Lost Password?

Register now!

Main Menu

Search

skimpydog.com Forum Index
   Redhat Base
  RHEL5

Browsing this Thread:   1 Anonymous Users

 

 Bottom   Previous Topic   Next Topic
  •  Rate Thread
      Rate this Thread
      Excellent
      Good
      Average
      Bad
      Terrible
Poster Thread Rated:  5 Votes
RHEL5
#1
Webmaster
Joined: 2007/6/10
From Dallas, TX
Posts: 79
Level : 7
HP : 0 / 170
MP : 26 / 8771
EXP : 83
Group:
Webmasters
Registered Users
Offline
RHEL5
There are errors in this DOC, please know this.:
-- This is not a final copy

This may be printed by clicking on this line.

There are a few people giving notes as this is being written. I hope they are willing to add their names to this contribution.
As of yet:
Chris Forsyth
Kevin Landreth
James Jhurani
Brandon Broyles
Brian Kontrath
___

During the install I will recommend to "cd /mnt/sysimage".

From here "ls" and see what all has actually been installed.

If you are familiar enough with editing the files directly you will be able to go into /etc and edit services such as samba (smb), apache (httpd), sendmail, ftpd (vsFTP), squid, named (bind), before you have to reboot the server initially.
-- This is good to do to not waste the time during the installation.
--* You may also chroot /mnt/sysimage during the installation, this is after the right rpm's are installed.
-----*** Don't forget you need to reboot the machine after the installation. Don't stay in the chroot'ed environment while making changes to partitions and such. It's probably not a wise idea, but hypothetically this would not harm anything...
--- I will simply recommend to see the files as they are created using ls, and have fun:

USE TAB COMPLETION!!!
USE "*" as wildcards!!!


###################################
Permissions & FileSystems:

At a bash prompt, as root:
ls -lah
drwxrwxrwx 2 apache apache 4.0K Jan 6 2007 html


This will show the overall set of permissions for the files you are reviewing.

The layout is like this:

User|Group|World
- rwx | rwx | rwx
looked at as for the example being 755:
-rwxr-xr-x

This is to say the "file" has read, write, and executable permissions by the User, read and execute permissions by the Group, and read and execute for the World.

It may also read as:
drwxr-xr-x

This is to say the "directory" has read, write, and executable permissions by the User, read and execute permissions by the Group, and read and execute for the World. Note the "d" at the beginning.
--------
For example, use "vim" to open a directory. View the output. It's a container.
--------
4 2 1
R W X
-
4=Read
2=Write
1=eXecute
--------
There is actually a mathematical value to each of these:
The following command would allow httpd access to outside users, so this directory may serve web pages:
chmod 755 /var/www/html


755
4 + 2 + 1 = 7 == User bit (first column)
4 + 1 = 5 == Group Bit (second column)
4 + 1 = 5 == World Bit (Third column)

Easy to remember:

4 2 1
R W X


The first bit that is referenced to 'some of the time' is the SUID bit.

To do a chmod properly every time, it would include:
chmod 0755 /var/www/html
-- assuming it does not need the bit, but it may for group sharing.

whereas:
chmod 2755 /var/www/html
would allow this to be a group share
ls -l
drwxr-sr-x
Look at the "s" in the "x" spot under the group user!
what you are looking at is the Group User having the "share" because in the regard is being enabled to have use for Group Shares.

This is also represented by:
chmod g+s /var/www/html
all it does is make it a group share

This is controlled by what you have setup in your:
/etc/group

--------
chmod 755 == rwxr-xr-x
chmod 110 == --x--x---
__________________________________
chown:

-R == recursive === All subfolders and files (depending on what you are doing) - it's a hierarchy

chown user:group /file/to/be/owned

chown -R user:group /directory/recursive
__________________________________
chattr & lsattr:

lsattr filename --- shows file attributes
chattr --- changes the file/folder attributes

"+" -- add attribute
"-" -- remote attribute
"=" -- be the ONLY attribute

Ex:

Works recursively
chattr -R


Immutable. Can be set or cleared only by a privileged user. Makes the file unable to be deleted or modified.
chattr +i /etc/filename


Clears the immutable flag.
chattr -i /etc/filename


Makes this the only attribute - Immutable - cannot be deleted, Nor may the file be modified - therefore the file will always exist.
chattr =i /etc/filename


Undeletable. This causes a file to be saved even after it has been deleted, so that a user can undelete it later.
chattr +u /etc/filename

---- For example:
touch touched && chattr +u touched
rm -rf touched
ls touched~
---- The "touched~" that still exists is the "undeleted" file. Like a recycle bin. There is no attribute flag associated.
From there you can remove the touched~
rm -rf touched~

________________________________
umask:

umask is the default permissions set to a file or folder.
-- This is hard to explain, but I will try:

The inverse of 0755 of a directory is 0022

The inverse of 0600 on a file is 0066

Files: 0666 - Inverse: 0000
Folders: 0777 - Inverse: 0000

The reason why the Inverse is mentioned, is because this is what you will have to set the default umask to to the initial persissions of a file or directory. This is to say, this is what you DO NOT want setup when a new file is created. For example: using the "mkdir" command to create a new directory, or "touch" to create an empty file.

So if I want the default permissions on a directory to be "755" when it is created, I will have to change this manually if the default permissions are set to "0022".

If you run:
#umask
0022
Then the default permissions to the File created will be:
644
The Default permissions to a Directory will be:
755
This is because of the umask being set to:
0022.

To change the umask value do the following:
#umask 0000
This will give Directories the permissions of:
0777
This will give Files the Permissions of:
0666

I will then need to manually change the permissions with the chmod command:
#chmod 755


There is an offset between Files and Directories in the filesystem - this is the differential between them in regards in reference to umask. The offset is by "1". Directories naturally will be one digit higher than files.
________________________________
acl:

This depends on how the filesystem is mounted. Just add:
acl
to the /etc/fstab for the desired mount point.

Display the acl info on the Directory/File:
getfacl

Set acl permissions on a Directory/File:
setfacl

Ex:
Set the permissions on the specified Directory to have read and eXecute rights for the user, and mask:
setfacl -m user:UserName:r-x /home/UserName
setfacl -m mask:r-x /home/UserName

Block other users from being able to access individual files:
chmod 700 /home/UserName/file1

Set the acl for the file, file1, and give it read permissions to the user:
setfacl -m user:UserName:r-- /home/Username/file1
setfacl -m mask:r-x /home/UserName/file1


####################################
Networking & Securing:

Network:

Using the current network configuration files, things are rather easy to manipulate.

This is the basics of the file:
vim /etc/sysconfig/network-scripts/ifcfg-eth0

#!/bin/sh
DEVICE=eth0
IPADDR=192.168.0.2
NETMASK=255.255.255.0
NETWORK=192.168.0.0
BROADCAST=255.255.255.255
GATEWAY=192.168.0.1
ONBOOT=yes


Other commands that are relevant are:
Configure network interface:
ifconfig

Bring up the network interface:
ifup eth0

Take down the network interface:
ifdown eth0

Restart the network using the inet.d script:
service network restart

Add Route (gateway):
route add default gw 192.168.0.1 eth0

Remove Route (gateway):
route del default gw 192.168.0.1 eth0

netstat:
netstat

netstat:: show current sshd port:
netstat -tnlp | grep sshd


Get a new dhcp'd IP Address:
dhclient

________________________________
tcp_wrapper aka "hosts_access":

man -k hosts_access

/etc/hosts.allow
/etc/hosts.deny

vim /etc/hosts.deny

These 2 lines both do the same thing of blocking a service:
smtp: .domain.com
sshd: .domain.com

This blocks everything from gaining any sort of remote access:
ALL: ALL
You can do this in the /etc/hosts.allow and /etc/hosts.deny
-- The /etc/hosts.allow takes precedence.

Good thing these two files use the same syntax!

Block users from the iprange 192.168.1.*
vim /etc/hosts.deny
sshd: 192.168.1.

Only deny the iprange of 192.168.2.*
vim /etc/hosts.deny
ALL EXCEPT sshd: 192.168.2.
sshd : ALL EXCEPT 192.168.2.


If you have in your /etc/hosts.deny
ALL: ALL
And you want to Allow ssh, and smtp access from 192.168.2.* and 192.168.3.*, but you do not want to allow it from 192.168.4.*; do this:
sshd, smtp : 192.168.2. 192.168.3. EXCEPT 192.168.4.

________________________________
iptables & NAT

man iptables

-t == Table - and too much to explain, view the man page
-A == Append to the end of the Chain
-D == Delete
-L == List the current iptables rules
-F == Flush the current iptables rules

If you are using -A or -D, you will want to use one of the following:
INPUT
OUTPUT
FORWARD


Then the rule will need to be followed by the Packet Pattern:
-s == specific source IP Address
-d == specific destination IP Address
-p == specified Port (by service name {such as tcp, icmp, ftp, http, })
--dport == specified port number

-j == what to do?!?!?
Tell the rule what to do in the situation:
DROP
REJECT
ACCEPT


Ex:
List the current iptables rules:
iptables -L

Reject data from the IP 192.168.0.12:
iptables -A INPUT -s 192.168.0.12/24 -j REJECT

Drop ping requests from the IP 192.168.0.12:
iptables -A INPUT -s 192.168.0.12 -p icmp -j DROP

Stop TCP SYN from within your network of 192.168.0.0:
iptables -A INPUT -s !192.168.0.12/24 -p tcp -j DROP

Delete the block icmp(ping) from 192.168.0.12 in the iptables rules:
iptables -D INPUT 192.168.0.12 -p icmp -j DROP

Stop packet forwarding:
iptables -A FORWARD -j DROP

Allow other users to use squid on your server:
iptables -A INPUT -p tcp --dport 3128 -j ACCEPT

Save iptables rules:
service iptables save


Make it Live!
chkconfig iptables on


Use the GUI to edit your iptables rules:
system-config-securitylevel-tui


IP Masquerading - aka NAT:

First off, in order to control/use NAT on a server, you must have more than one Network Interface Card

You may need to enable a few Kernel Modules in order to use some of the functionalities of IP Masquerading, and these may be found if you have the source code for the Kernel on your system:
/usr/src/redhat/BUILD/kernel-*(version)/linux-*(version)/net/ipv4/netfilter


You will need to enable IP Forwarding:
vim /etc/sysctl.conf

net.ipv4.ip_forward = 0
TO:
net.ipv4.ip_forward = 1

-- You will need to reboot to make these settings take effect...

Now you may run:
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE
-- This is assuming the inet connection is going through eth0, and your network IP's that will be routing through this firewall are on the IP Range of 192.168.0.0/24.
________________________________
SELinux:

SELinux is broken up into 3 components:
System User
System Object
Type of sharing with others


SELinux man page:
man selinux
Scroll down to the bottom, You will see several other man pages listed for services such as:
ftpd_selinux
named_selinux
httpd_selinux
samba_selinux
nis_selinux
keberos_selinux
ypbind_selinux

From here you may run ls -Z to display the SELinux settings for the directories you are viewing.

For Apache
If the permissions are set to:
system_u:object_r:user_home_dir_t
This will not work while allowing apache to have proper access rights.
To fix this run:
chcon -t httpd_sys_content_t


For example - content_t:
chcon -R -t httpd_sys_content_t /var/www/html

For the cgi-bin - script_exec_t:
chcon -R -t httpd_sys_script_exec_t


For Samba - share_t:
Make the share accessible /mnt/DVR:
-- This is however only relevant if the stanza for the location /mnt/DVR is setup.
chcon -R -t samba_share_t /mnt/DVR


cd /etc/selinux/targeted/contexts/files/
vim file_contexts.local
By default there is a file_contexts file you may use for reference, BUT YOU HAVE TO CREATE IT!!! MEMORIZE THIS! - if you want... I will advice to make the directories you need to, that You have set, such as apache, samba, named, nfs, ypbind and any other services like such:
/srv/project(/.*)? system_u:object_r:ftpd_anon_rw_t
/home/UserName/html(/.*)? system_u:object_r:httpd_sys_content_t
/var/named(/.*)? system_u:object_r:named_zone_t
and so fourth.
The first line will set the directory & files to have the permissions of ftpd_anon_rw_t and allow FTP users access to work with a SELinux enabled system
The second line will allow the /home/UserName/html/ directory and files to have http_sys_content_t which will allow httpd the ability to serve pages with SELinux
The third line will allow /var/named/ Directory and files to work with named_zone_t and allow named to work properly with SELinux

Like I said, you can use the /etc/selinux/targeted/contexts/files/file_contexts as a quick reference for syntax, and values.
________________________________
/etc/nologin:

/etc/nologin
This will prevent regular users from being able to login!
-- Just rename the file, call it /etc/nologin.old if you need.
--- generally speaking it's OK to delete this, but sometimes it's better to move.

####################################
rpm:

rpm == Redhat Package Management

Install a rpm:
rpm -ihv filename.rpm

Upgrade a rpm:
rpm -Uhv filename.rpm


It is possible to Install/Upgrade more than one rpm at a time:
rpm -Uhv filename.rpm filename2.rpm /home/Username/Download/file3.rpm


Query for a rpm that's installed:
rpm -aq | grep rpm-name

OR
rpm -q rpm-name


####################################
gpm:

Mouse Support at console - no gui!!

Make it Live!
service gpm start
chkconfig gpm on


###################################
man:

See what man paged there are:
man -k manpage

Reference to the specific manpage:
man 1 manpage

Reference to the general manpage:
man selinux


####################################
Sendmail:

edit:

vim /etc/mail/sendmail.mc


page down till you see where it says:

DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl


change the 0.0.0.0 to the loopback address 127.0.0.1

DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
save the changes!

at the top of this file there is a command, reopen sendmail.mc if you need to look,
Then run:
make -C /etc/mail


Make it Live!
service sendmail start
chkconfig sendmail on

________________________________
Test the mail server:

Test SMTP:
telnet 127.0.0.1 25
-- use <ctrl>] to break out of the connection

###################################
Dovecot:

There is nothing to configure - now you will have POP3, and IMAP

Make it Live!
service dovecot start
chkconfig dovecot on

________________________________
Test retrieval protocols:

Test POP3:
telnet 127.0.0.1 110

Test IMAP:
telnet 127.0.0.1 143


###################################
Cups:

I will recommend to actually use the gui for printer configuration.

system-config-printer


Make it Live!
service cups restart
chkconfig cups on


###################################
Samba aka smb:

vim /etc/samba/smb.conf



Create the stanzas as you see fit.

printable == PRINTER!!!
Workgroup == Workgroup Name for Directory Browsing
_______________________________

smbpasswd -a username


Will yield:
smbclient -L 127.0.0.1 -U user
Password:


To connect to the smb server:
smbclient \\\\127.0.0.1\\sharename -U user
Password:


Make it Live!
service smb start
chkconfig smb on


###################################
squid:

vim /etc/squid/squid.conf


drop in:

MEMORIZE THIS!:
</snip>
visible_hostname localhost
acl local_net src 192.168.1.0/24
http_access allow local_net
</snip>

Create the initial swap directories:
squid -z


Make it Live!
Service squid start
chkconfig squid on


###################################
named:

Copy the files from location:

cp /usr/share/doc/bind-9*/sample/etc/named.rfc1912.zones /etc/
cp /usr/share/doc/bind-9*/sample/var/named/* /var/named/
cd /etc
mv named.rfc1912.zones named.conf
Edit the file for the zone you want at the bottom, and comment out any zones you do not have config files for...
-- If you have copied the files from:
/usr/share/doc/bind-9*/sample/var/named/ to /var/named, you should be OK.

addin the /etc/named.conf at the top:
<snip>
options {
	directory "/var/named";
};
</snip>

This can also be found in the /usr/share/doc/bind-9*/sample/etc/named.conf
-- it's under the first "options" stanza - just remember you need the "options", and "directory"

Be sure to make the matching:

/var/named/example.com.zone file, and be sure to remove the "root" option from the sample if you use the "localdomain.zone"
and add any "A" records that may be required....

chmod 777 /var/run/named
chown named:named /var/named


/etc/resolv.conf - DNS resolver (be sure to have 127.0.0.1 listed if you are setting up DNS as well as your real DNS server that it will read as the master DNS server)

test the configuration
named -g


set specific user to run as after the service is daemonized
named -u


Make it Live!
service named start
chkconfig named on


###################################
httpd:

/etc/httpd/conf/httpd.conf --- Main httpd configuration file - This will have the basic layout of the server, and stanza qualifications
--- At the bottom of this file is the basic stanza you will want to setup for Virtual Servers
---- Just use (for example:) "7 yy" - while in "vim" to copy the lines, then you can "vim ../conf.d/example.com"

/etc/httpd/conf.d/ --- where the config files for Virtual domains may be located

Be sure to have "DocumentRoot "/var/www/html"" "defined the same as <Directory "/var/www/html">"

If you need SSL support, use /etc/httpd/conf.d/ssh.conf as an overall reference.
-- Keep in mind you may only have 1 SSL per IP.

Make it Live!
service httpd start
chkconfig httpd on

________________________________
Test the http server:

elinks localhost
OR:
elinks domainname.com


###################################
vsFTPd:

Main Directory: /etc/vsftpd

Make it Live!
chkconfig vsftpd on


###################################
xinetd:

Location of the configuration file:
/etc/xinetd.conf


There will be several variables & parameters that may be used:
socket_type == Specified the Communication Stream
wait == yes for a single threaded application, no for a multi Threaded Application
user == Account User which the server should run
group == Account Group which the server should be run
server == The server Program
only_from == Hostname or IP which is allowed to use this server
no_access == Hostname or IP NOT allowed to access the server
log_on_failure == If there is a failed login attempt, this specified where this is logged
disable == By default Yes, which disables the server

There is also the xinetd.d folder, which it's location is defined in the /etc/xinetd.conf and this is specified a the bottom of the file with the:
includedir
directive.

Make it Live!
chkconfig xinetd on


###################################
ntpd:

/etc/ntp.conf
hwclock
date
ntpdate -u pool.ntp.org

It may be easier to setup the ntp client in the gui:
system-config-time

Make it Live!
service ntpd restart
chkconfig ntpd on


###################################
Auto Mount:

MUST BE DONE!!!
chmod 755 /etc/auto.net


setup automount points in:
/etc/auto.misc
-- these will be listed, and accessible in /misc/mountpoint
using "ls" will activate this (so to speak)...
___________________________

setting up automount for /mnt/movies using nfs.

add your new directory, and config location to /etc/auto.master
eg: /mnt /etc/auto.movies

then create /etc/auto.movies
chmod 755 /etc/auto.movies

in auto.movies add:
movies -fstype=nfs,intr,tcp ip:/dir

you will not see it if you ls in /mnt. You have to literally cd /mnt/movies for it to actually mount.

###################################
fdisk:

fdisk /dev/sdb


m == help manu!!!
n == Creates new partition as you define it to be
t == changes the "type" of partition
--- this includes swap, LVM, RAID, FAT16, Solaris etc...
----- Press "L" for the type list
d == deletes a partition
w == saves changes
q == quits

###################################
e2label:
e2label == Partition Labeling

shows the current label
e2label /dev/sda1


sets the label for /dev/sda1 to /boot
e2label /dev/sda1 /boot


You can change the label for almost all devices such as:
Disk Partitions
LVM
RAID
etc...
You may use the LABEL by using the /etc/fstab, and using the LABEL=/ directive

###################################
Software RAID:

First off BE SURE TO SET THE PROPER FLAG IN FDISK FOR THE PARTITION TYPE TO
"linux raid auto"

You may have to reboot the server to make the partition changes to take effect
Depending on the scenario, you may be able to run:
"partprobe" instead of rebooting.

mdadm
-v == verbose
-c == create
-l == RAID Level
-n == number of devices
-f == Force
-r == Remove
-a == add

Build a Software RAID Level 6 out of 4 partitions
mdadm -v -c /dev/md0 /dev/md0 -l 6 -n 4 /dev/sdb{4,6,7} /dev/sda7


to view the status of the array
cat /proc/mdstat


Format /dev/md0 with the ext3 filing system
mkfs.ext3 /dev/md0


make sure this is mounted!!!

so it will mount after the machine reboots
vim /etc/fstab
add in there:
/dev/md0	/mnt/RAID6	ext3	defaults	0 0
Save Changes

mkdir /mnt/RAID6
mount /mnt/RAID6

________________________________

Fail an array:
mdadm -v /dev/md0 -f /dev/sdb6 -r /dev/sdb6


Add a replace partition that is the same or larger size:
mdadm -v /dev/md0 -a /dev/sdc2
--- This will rebuild the array

To view the status of the array
cat /proc/mdadm



###################################
LVM:

1)Please keep in mind, if you resize a "LV" - "LogicalVolume" this can be OK if you are growing the partition using resize2fs.
2)If you are shrinking the partition, be sure to save the data first, then shrink the lv, then format the partition.

pv<tab><tab>
vg<tab><tab>
lv<tab><tab>

pv == Physical Volume:
-- this is what the "vg" - "VolumeGroup" Needs to be created

vg == Volume Group:
-- 2 or more "pv" - "PhysicalVolumes" acting as 1 physical Device - what "lv" - "LogicalVolumes" are made from

lv == Logical Volume:
-- This would be the actual mountable device - so to speak

First off BE SURE TO SET THE PROPER FLAG IN FDISK FOR THE PARTITION TYPE TO
Linux LVM
Set all available partitions you wish to be "pv"'s in fdisk - this is very important!

This creates the PV's for the partitions listed above:
pvcreate /dev/sdb{1,2,3,4} /dev/sda9


This creates a VolumeGroup named "VolumeGroupName" using /dev/sdb1 and /dev/sdb2:
vgcreate VolumeGroupName /dev/sdb{1,2}


Use this to add /dev/sdb3 to the Volume Group "VolumeGroupName":
vgextend VolumeGroupName /dev/sdb3


Split Volume Group:
vgsplit VolumeGroupName VolumeGroupName2 /dev/VolumeGroupName


Creates a "LV" "LogicalVolume" that is 500MB named lvm1:
lvcreate -L 500M VolumeGroupName -n lvm1


Assuming there is 2gb of space available in the VG, this will resize the LV "lvm1" to 2GB
lvextend -L+2G /dev/VolumeGroupName/lvm1

Make sure the Format is correct:
resize2fs /dev/VolumeGroupName/lvm1



If there is not enough space in the VG, use:
vgextend VolumeGroupName /dev/sdb4 /dev/sda9
this will use the rest of the PV's we initially created in this example

New LV:
mkfs.ext3 /dev/VolumeGroupName/lvm1
mkdir /mnt/lvm1
mount /dev/VolumeGroupName/lvm1 /mnt/lvm1
or just make sure the Format is correct if you grew the LV:
resize2fs /dev/VolumeGroupName/lvm1


edit fstab so it is available after a reboot:
vim /etc/fstab
Add:
/dev/VolumeGroupName/lvm1	/mnt/lvm1	ext3	defaults 0 0


Other ways to use manage LVM's is as follows:
Scan the system for lvm's
lvm vgscan

Make the lvm active
lvm vgchange -ay


###################################
NFS:

vim /etc/exports
Insert the mountable locations you want:
/home    (rw)
/media/DVR    192.168.1.0/255.255.255.0(ro)


You may also give the mount options of sync, and nosync. There are several other options as well...

then run:
exportfs /home /media/DVR

_____________________________
Mount NFS:

vim /etc/fstab
Insert:
192.168.1.12:/home    /home   nfs    defaults 0 0
192.168.1.12:/media/DVR   /Media   nfs noauto


This will make your /home directory located on the server 192.168.1.12, but mounted at your /home.
-- keep in mind it the nfs server fails, or other errors persist, then the /home directory will not mount.


Make it Live!
service nfs start
chkconfig nfs on


####################################
crontab:

* * * * *
Minute == 0-59
Hour == 0=23
Day Of Month == 1-31
Month 1-12
Day of Week 0-7 (0 or 7 is Sun, or use names)

Edits the current users crontab:
crontab -e

Lists the output of the current users crontab:
crontab -l

Edits the users crontab specified:
crontab -e -u user

Lists the output of the users crontab specified:
crontab -l -u user

Removes the crontab for the specified user:
crontab -r -u user


crontab works as follows:
crontab -e -u user

every Monday at 12pm, the script will run
* 12 * * 1 /some/script/or/command


Other options may go as follows:
crontab -e -u user

Every day his daughter get's out of school at 3:15pm, this will echo on the console:
15 15 * * 1,2,3,4,5 echo "Your daughter is out of school - You are late!"


###################################
quota:

Edit the /etc/fstab with the mounted partitions.
Make sure the quotated partition will include the correct options:
usrquota,grpquota
Ex:
LABEL=/1   /   ext3   defaults,usrquota,grpquota   1 1


Turns quotas on on the / partition
quotaon /

checks the initial value of the quotas per the specified mount point
quotacheck -cgum  /

edit a users quota
edquota username

Grace Period
edquota -t


###################################
LDAP & NIS:

ypbind - nis client for resolving nis domains

easy way:
system-config-authentication
-- Fill in the blanks....

###################################
mkinitrd:

This is a lil tricky if you are not used to doing this:

First, boot to a live CD, another environment in essence...
Second, mount the partitions for the filesystem into a folder such as /mnt/sysimage
Third, chroot into the new enviornment:
chroot /mnt/sysimage

Then you may run:
mkinitrd /boot/initrd-2.2.17.img  2.2.17


This should regenerate the initrd image needed for the initial RAM Disk.

###################################
Xorg:

Let’s say the /etc/X11 directory is gone, to restore, do all of the following:

You will need to restore the xfs for fonts:
This will reinstall the /etc/X11/fs directory
rpm –ihv –force /path/to/RHEL/Files/xorg-x11-xfs-1*.rpm


This will reinstall the /etc/X11/prefdm executable
rpm –ihv –force /path/to/RHEL/Files/initscripts-8*.rpm


-------------------
create the xorg.conf:
Xorg –configure
Copy the file to the proper location:
cp /root/xorg.conf.new /etc/X11/xorg.conf
Or
system-config-display

Ultimately speaking you will want to make sure the xorg.conf is located at /etc/X11/xorg.conf when things are said and done.

start the font server:
service xfs start


Launch gnome:
telinit 5
or
gdm


launch X - xdm (most likely):
startx


--- dm == Display Manager
ex:
gdm == Gnome Display Manager
kdm == KDE Display Manager
xdm == "X" Display Manager

###################################
Grub:
e - edits existing kernel arguements - not saving - Be sure to make changes final by editing /boot/grub/grub.conf or /boot/menu.lst (same file)
c - Grub command line

-- easy way to remember this:

normally this will work, and it will find root(hd0,0) automatically
root <enter>


let it will in the blanks, and give options
-- but the line complete should read as for run level 3 with selinux:
On the line below: "root=LABEL=/1" - this is in reference to the e2label
--- normally this would be "/", but it is actually "/1" due to selinux
Remember we are going to use the compressed kernel - that's the "vmlinuz":
kernel /vm<tab>

Should read in full as:
kernel /vmlinuz-2.6.18 ro root=LABEL=/1 3


Make sure the initrd matches the kernel image defined in the kernel argument:
initrd /in<tab>

boot

--------------------------------

Be sure to make changes final by editing /boot/grub/grub.conf or /boot/menu.lst (same file)

Keep grub simple. It is easier!!! & it won't break!!

The entire stanza should read as:
root (hd0,0)
kernel /vmlinuz-2.6.18 ro root=LABEL=/1 3
intird /initrd-2.6.18.img


###################################
/etc/init.d:

This is the basics of the services that may be launched via the "service" command.

Starting and stopping services:
/sbin/service sshd start
service sshd start
service httpd restart
service mysqld restart
service squid stop

etc...
cd /etc/init.d && ls


###################################
vim:

Once in vim, the environment once understood is not soo bad:
(although the Unix vi is a lil different...)

if all else fails, hit the <esc> key a few times.
-- it will bring you back to the "top" so to speak

i == insert
r == replace
x == delete
dd == delete the line
:q! == quits without saving
:w! == saves changes
:x! == saves and quits
7yy == yanks 7 lines - starting where the curser is at
p == pastes the yanked lines
:e /path/to/file == opens/creates a file to edit
:we! /path/to/file == saves the current file and opens/creates a file to edit

no line wrapping
:set nowrap
--- This must be enabled once vim is launched.

###################################
Misc:

/etc/sysconfig == main RHEL configuration directory
/etc/sysconfig/network-scripts/ifcfg-eth0 == location for eth0
/etc/sysctl.conf == sysctl configuration for the machine
--- This is where you may add:
kernel.panic = 5
----- so the machine will reboot 5 seconds after a kernel panic

mount -t nfs 192.168.1.12:/mnt/lvm /mnt/nfs
mount -o remount,ro /

useradd <username> ; passwd <username> --- add a user, and the users password
/etc/hosts --- hosts file - can control connectivity, and defign the hostnames

mkdir -p /home/username/{folder1,folder2,folder3} && touch /home/username/folder1/touched

ps axl | grep service
ls -lah


cp -R /home/. /backup/ == This will copy the files and folders recursively
mv /root/file1 /root/file2 == This is the same as renaming a file or folder
mkdir /home/username = creates the one folder
mkdir -p /home/username/html/{folder1,folder2,folder3}
--- this will create the folders in the path as needed, as well as
------ /home/username/html/folder1
------ /home/username/html/folder2
------ /home/username/html/folder3
Posted on: 2007/10/19 16:26
Create PDF from Post Print
Top
Re: RHEL5
#2
Webmaster
Joined: 2007/6/10
From Dallas, TX
Posts: 79
Level : 7
HP : 0 / 170
MP : 26 / 8771
EXP : 83
Group:
Webmasters
Registered Users
Offline
Good thing there's the option to print this!

You can also just copy and paste it into Notepad, and it all works out well...!

Be sure to look at the post time, and date if you need to to see if there have been modifications....
Posted on: 2007/10/19 19:16
Create PDF from Post Print
Top
 Top   Previous Topic   Next Topic

 


 You cannot start a new topic.
 You can view topic.
 You cannot reply to posts.
 You cannot edit your posts.
 You cannot delete your posts.
 You cannot add new polls.
 You cannot vote in polls.
 You cannot attach files to posts.
 You cannot post without approval.
Links