Linux
Tips
Disclaimer: This list is AS IS and may contain all kinds of mistakes and misinformation. Use it at your own risk. Don't try something here on something important and then come to me if it screws up. I accept no responsibility. There is no warranty, express or implied. If you disagree with these terms, do not read on and exit now.
A
Issuing:
/etc/rc.d/init.d/httpd (stop) (start) (restart) (status) (reload) (graceful) will do it.
Take a look a /etc/rc.d/init.d/http and you'll see the possibilities listed.(Apache 1.3.27)
usage: /usr/sbin/apachectl (start|stop|restart|fullstatus|status|graceful|configtest|help)start - start httpd
startssl - start httpd with SSL enabled
stop - stop httpd
restart - restart httpd if running by sending a SIGHUP or start if
not running
fullstatus - dump a full status screen; requires lynx and mod_status enabled
status - dump a short status screen; requires lynx and mod_status enabled
graceful - do a graceful restart by sending a SIGUSR1 or start if not running
configtest - do a configuration syntax test
help (or no argument) - the above infoI was able to add a virtual host www.pentium.cxm using IP 192.168.1.2 by adding this to /etc/httpd/conf/httpd.conf:
NameVirtualHost 192.168.1.2
<VirtualHost 192.168.1.2>
ServerName www.pentium.cxm
DocumentRoot /home/httpd/html
ErrorLog logs/www.pentium.cxm-errorlog
</VirtualHost>Restart Apache to reread the config file when you're done. Of course you'll need a DNS or line in the HOSTS file to reference it.
config file - You can find apache's config file by issuing httpd -V. The combination of SERVER_ROOT and SERVER_CONFIG_FILE will lead you to it.
Redirect - If you have changed domains and want the old domain to redirect to the new one:
Unfortunately, hits to directories, not the root, gets you a 404. You have to put an .htaccess file in each directory. In http://www.olddomain.com/foo, put
Redirect 301 /foo http://www.newdomain.com/foo
apropos - apropos keyword is the same as man -k keyword.. Use it when you don't know the command to do something. It will search the man database for the keyword. If the manpage is in man 5, type man 5 command.
apt - kpackage has disappeared and redhat-config-packages sucks, but it doesn't matter since apt has been ported to rpm-based distros.
That's all I had to do, and it worked great after that.
/etc/apt/sources.list is a textfile that lists repositories. You can add more than the default one, listing the fastest ones first (try ping or traceroute). You can look for repositories at http://apt-rpm.tuxfamily.org/ or http://dag.wieers.com/home-made/apt/ You put the whole thing starting with "rpm" in your sources.list file and save it.
B
bashrc - After making changes to .bashrc or .bash_profile, you can either log out and back in or run the "source" command e.g. source .bashrc.
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias ping='ping -c 4'
alias du='du -shc'
alias df='df -h'
alias ls='ls -Fa'
alias x='startx'
alias sd='shutdown -h now'
alias rb='shutdown -r now'
alias nic0='kwrite /etc/sysconfig/network-scripts/ifcfg-eth0'
alias nic1='kwrite /etc/sysconfig/network-scripts/ifcfg-eth1'
alias untar='tar -xzvf'
alias p1='ping -c 4 192.168.1.1'
alias p2='ping -c 4 192.168.1.2'
alias p3='ping -c 4 192.168.1.3'
alias mntc='mount -v /mnt/cdrom'
alias mntf='mount -v /mnt/floppy'
alias umntc='umount -v /mnt/cdrom'
alias umntf='umount -v /mnt/floppy'
alias kd='kedit'
alias mf='mount -t ext2 /dev/fd0 /mnt/floppy'
alias mntf='mount -v /mnt/floppy'
alias cgi='cd /home/httpd/cgi-bin'
alias httpdrestart='/etc/rc.d/init.d/httpd restart'
alias namedrestart='/etc/rc.d/init.d/named restart'
alias httpdreload='/etc/rc.d/init.d/httpd reload'
alias namedreload='/etc/rc.d/init.d/named reload'
alias mysqldstart='/usr/bin/mysql_safe &'
alias gonamed='cd /var/named'
alias gofloppy='cd /mnt/floppy'
alias gocd='cd /mnt/cdrom'
alias gocdrom='cd /mnt/cdrom'
alias gorpm='cd /mnt/cdrom/RedHat/RPMS'
alias nocomments='grep -E '^[^#]' $1'
alias nocomment='grep -E '^[^#]' $1'
alias win2k='mount -t smbfs -o username=glenn,password=usual,ip=192.168.x.x //computername/sharename /win2k'
alias smbrestart='/etc/rc.d/init.d/smb restart'
alias sambarestart='/etc/rc.d/init.d/smb restart'
alias dmesg='dmesg | less'
alias ifconf='ifconfig | less'
alias ifc='ifconfig | less'
alias services='service --status-all | less'
alias messages='tail -n 50 /var/log/messages'
alias bashreload='source /root/.bashrc'
alias new='source /root/.bashrc'
alias inittabrestart='telinit q'
alias xinetdrestart='/etc/rc.d/xinetd restart'
alias sendmailrestart='service sendmail restart'ejcd()
{
cd ; eject
}lc()
{
cd $1 ; ls
}cat /root/.signature > /root/.sig
/usr/games/fortune >> /root/.sig
/usr/games/fortune > /etc/motd
bigmail - A command line check for large mailboxes
find /var/spool/mail -size +6500 -print
Boot disk for the current system - make one
At the prompt, type #mkbootdisk --device /dev/fd0 2.2.9-19 (for my system; you'll have to enter the kernel info for yours)
Run uname -a for the kernel info.
Floppy should not be mounted when this command is run.
C
cat writes out a file
cat -n numbers all lines
cat -s squeeze multiple blank lines into one
cat -v display all characters, including invisible ones, except for tabs and newlines
cat -A display all charactersYou can make a simple document by typing at the command line:
cat - > filename
Then you finish it by entering Ctrl - d
dev4,0 stand for SCSI ID and bus in that order. My cd burner happens to be on ID 4. You can check the SCSI information by looking at dmesg:
- Put everything you want on the CD in a folder named cdimage
- Change the folder's contents into an iso image with this command:
mkisofs -r -o cdimage.iso cdimage- Try mounting the image to make sure it's OK:
mount -r -t iso9660 -o loop cdimage.iso /mnt- 4. If everything looks OK, burn with:
cdrecord -eject -v -isosize speed=2 dev=4,0 cdimage.iso#dmesg | less
For IDE CD burners that appear as SCSIs (don't ask), you can fine the target by running
#cdrecord --scanbus
The following about burning downloaded .iso files comes from the Red Hat list:
The .iso files are image files, a snapshot if you will, of the directory tree that has the
files, in packages, that you want to burn. In linux:
then unmounted the files go away from the directory you created and you
can repeat the steps for the second iso file.
A Linux Journal article
on burning mondoarchive disks suggested this simple command:
#cdrecord dev=0,0,0 speed=xx
/home/mondo/1.iso
On http://www.ccp14.ac.uk/ccp14admin/linux-server/mondorescue/cd_rom_mondo.html we find this advice:
Burn Mondo images with CD-R media:
cdrecord dev=0,0,0 speed=4 /root/1.iso
cdrecord dev=0,0,0 speed=4 /root/2.iso
Writing an ISO image with CD-RW discs:
cdrecord -blank fast dev=0,0,0 speed=4 mindi.iso
Blanking an ISO image with CD-RW discs:
cdrecord -blank fast dev=0,0,0
Compiling and installing downloads
When you download a tar file from the net untar it with this command:
tar -xzvf /(path to file)/(filename.tar.gz) [enter]then
./configure [enter]
make [enter]
make install [enter]
If you don't want to use vi, run
export EDITOR=pico
RH7.3 wouldn't let root make a crontab. I had to create /etc/cron.allow and put the one word "root" in it. /etc/cron.deny will disallow any users listed from making crontabs.
Actual crontab files are in /var/spool/cron named for their creator. Root's crontabs will be /var/spool/cron/root.
"crontab -e" will start a crontab for you. They follow this pattern:
minute hour dayofmonth month dayofweek
1 1 * * * /usr/bin/fullback #This will run fullback at 1:01am every day
11,2,3 * * * /usr/bin/fullback #This will run fullback at 1:01, 2:01, 3:01am every day
11 * 1-15 * /usr/bin/fullback #This will run fullback at 1:01am on the first 15 days of the monthIf you get mail to root saying permission denied, you may have to do a chmod on the script. 700 worked for me.
Look at your crontabs with crontab -l (el)
D
dd bootsector of current Linux system to Windows partition (to add to NT bootloader by editing boot.ini)
dd if=/dev/(hda8) bs=512 count=1 of=/mnt/win/bootsect.lin
/etc/sysconfig/desktop make it say DESKTOP="KDE"
DHCP server set up (Many thanks to Steve Litt of troubleshooters.com for the skinny on this)
1. Find out if it's already installed by running /etc/rc.d/init.d/dhcpd status
2. If it's not, install it by mounting the RPMS directory on the CD and issuing rpm -ivh dhcp*.rpm
3. Create /etc/dhcpd.conf. Make it say:#Set global options
option domain-name mydomain.cxm; (or whatever your domain name)
option domain-name-servers 143.90.130.22, 143.90.130.38, 192.168.1.1; (or whatever)
option netbios-neme-servers 192.168.1.2; (put your WINS server's IP here)
option netbios-node-type 8; (8 is WINS then broadcast, I think)
option nis-domain 'mynisdomain'; (never tried it; they say it works)#Set up a subnet
subnet 192.168.1.0 subnet 255.255.255.0 {
range 192.168.1.100 192.168.1.200; (or whatever range you prefer)
default-lease-time 604800; (604800 seconds=1 week)
max-lease-time 604800:
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.254 (or wherever your router is)
}#fixed IP host
host myprinter {
hardware ethernet 00:80:C7:16:48:A6; (ping the IP and then run arp -a to see the MAC address, at least on NT)
fixed-address 192.168.1.x (put in your host (printer's, etc.) address4. touch /etc/dhcp.leases Leave it empty.(In Mandrake 7.x this is /var/dhcpd/dhcpd.leases)
5.Run /etc/rc.d/init.d/dhcpd start. It should start up like so.Starting dhcpd: [OK]
6. To make it start up every time at boot-up at runlevel 3 (add 5 also for GUI runlevel)
ln -s /etc/rc.d/init.d/dhcpd /etc/rc.d/rc3.d/S65dhcpd (that's a space after the first dhcpd, of course)
7. There needs to be an empty file /var/dhcpd/dchpd.leases. Touch one of it isn't there. To see current leases after it's all running, cat the file cat /var/dhcpd/dchpd.leases, and you'll see see when the lease started and ends, what machine has the lease, the hardware address of the card, and of course the IP that was given out.
Directory
cd /
du -sh *
Setup for DNS is done in two places in Red Hat Linux - in /etc/ and in /var/named/. The /etc files are /etc/resolv.conf and /etc/named.conf. Let's look at them in turn.
DNS has, of course, two sides, the client (called the resolver) and the server. On Windows you can set the resolver in TCP/IP properties -> DNS; in Linux you put it in /etc/resolv.conf.
cat /etc/resolv.conf - Has only two lines:
search mydomain.cxm #because the server was set to mydomain.cxm at install time
nameserver 192.168.1.1 # the server's IP, of course, meaning your box (not your ISP's).
There's more, but that's probably about all you need. Any changes to /etc/resolv.conf will happen without restarting any services.
The /etc/named.conf points to the records in /var/named/. It will probably point to:
1. a hints file (named.ca) that lists the root servers for the Internet. This is the same as \winnt\system32\dns\cache.dns in Windows. I won't print it here; it's too long.Let's look at a working /etc/named.conf file:
2. a local host file This just resolves the loopback address to localhost. It's like the first line of a /etc/hosts file.
3. zone files These have most of the information of the zone.
4. reverse zone files The in-addr.arpa PTR files
cat /etc/named.confoptions {
directory "/var/named"; (Could be anywhere)
};zone "." {
type hint;
file "named.ca"; (The Internet name servers)
};zone "0.0.127.in-addr.arpa"{ (Loopback for localhost)
type master; file "named.local";
};zone "1.168.192.in-addr.arpa"{ (Reverse DNS file for the non-public network)
type master;
file "192.rev.hosts";
};zone "mydomain.cxm" { (The "main" domain I've set up. Hostnames are real.)
type master;
file "mydomain.cxm.hosts";
};zone "pentium.cxm" { (This exists only in cyberspace)
type master;
file "pentium.cxm.hosts";
};/var/named/named.local looks like this:
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
1 IN PTR localhost./var/named/192.rev.hosts (in W2K, 1.168.192.in-addr.arpa.dns)
@ IN SOA linux.mydomain.cxm. root.localhost. (
2001060201 ; serial
10800 ; refresh
3600 ; retry
2419200 ; expire
38400 ; default_ttl
)
@
2.1.168.192.in-addr.arpa
11
1IN
IN
IN
IN
NS
PTR
PTR
PTR
linux.mydomain.cxm
pentium.mydomain.cxm.
linux.mydomain.cxm.
linux.mydomain.cxm.@ IN NS linux.mydomain.cxm
2.1.168.192.in-addr.arpa IN PTR pentium.mydomain.cxm.
11 IN PTR linux.mydomain.cxm.
1 IN PTR linux.mydomain.cxm./var/named/mydomain.cxm.hosts (in W2K, mydomain.cxm.dns)
$TTL 1d
mydomain.cxm. IN SOA linux.mydomain.cxm. root.localhost. (
| 988532945
10800 3600 432000 38400 ) |
mydomain.cxm. IN NS linux.mydomain.cxm.Successful DNS with virtuals on Linux on a private network
linux.mydomain.cxm. IN A 192.168.1.1
pentium.mydomain.cxm. IN A 192.168.1.2The book shows a @ instead of the initial mydomain.cxm, but I don't know why.
/var/named/pentium.cxm.hosts
$TTL 1dpentium.cxm. IN SOA linux.mydomain.cxm. root.linux.mydomain.cxm. (
988532945
10800
3600
432000
38400 )
IN NS linux.mydomain.cxm. www<-- No period! IN CNAME linux.mydomain.cxm. <-- Period! (As it is up above)
It seems that CNAMEs don't have trailing periods before the IN, but A records do.
www.pentium.cxm.<-- Period! IN A 192.168.1.1
Make sure your other boxes have 192.168.1.2 as the DNS.
1. After doing the above, put a new directory "pentium" with an index page inside of the original document root so that you have /home/httpd/html/pentium/index.html, and make it say "Welcome to wwwpentium.cxm."
2. Leave the original index.html inside /home/httpd/html3. Add this to /etc/httpd/conf/httpd.conf
NameVirtualHost 192.168.1.1
<VirtualHost 192.168.1.1>
ServerName www.mydomain.cxm
DocumentRoot /home/httpd/html
ErrorLog logs/www.mydomain.cxm-errorlog
</VirtualHost><VirtualHost 192.168.1.1>
ServerName www.pentium.cxm
DocumentRoot /home/httpd/html/pentium
ErrorLog logs/www.pentium.cxm-errorlog
</VirtualHost>
The Apache conf files seem to have a special file for IP based virtuals, too, but I'm not quite sure how to use them.
You can look at a PTR record with the command nslookup -query=ptr
> nslookup -query=ptr 1.1.168.192.in-addr.arpa
Server: linux.mydomain.cxm
Address: 202.217.95.121You can use nslookup interactively:
> nslookup
> help(A bunch of options are displayed)
> set type=MX (for example, to see mail servers)
> mydomain.cxmServer: linux.mydomain.cxm
Address: 202.217.95.121With dig you don't have to put reverse lookup queries in reverse order:
> dig -x 140.90.141.131
;; ANSWER SECTION
131.141.90.140.in-addr.arpa> host -t ptr 161.203.16.2
2.16.203.161.IN-ADDR.ARPA domain name pointer www.gao.gov> host -t cname www.ee.umd.edu
www.ee.umd.edu is a nickname for server.ee.umd.edu
E
Remove a folder recursively
rm -rf (directory) "r" is recursive and "f" is force
environment - use set | less to see environment variables
echo $PATH, echo $HOME, echo $USRENAME etc. will show you selected parts of your environment.
export variablename=value such as export $PATH=/sbin
F
favicon ( the little non-generic icons in from of URLs on websites)
File filename tells you if a file's binary or text.
Find - some useful find commands
fdisk /dev/hdxx will make a new partition for you.
mke2fs /dev/hdxx will format it in ext2.
tune2fs -j /dev/hdxx will change if from ext2 t ext3..
mkfs.ext3 /dev/hdxx will format it ext3 the first time.
Format a floppy from the command line:
FTP default directories (from Red Hat mailing list)- Just add a user named, for example, backupetc. Then go in and edit the home directory entry in the passwd file to /etc. When you connect to the system, you will be plunked into that directory by default.
G
grep - You can look at the real text of a config file without the clutter of the #comment lines by issuing this command:
grub - (Great Universal Bootloader) - Grub was designed to make it easy to boot among multiple OSes installed on multiple partitions or HDs. Grub can be on a floppy or on the MBR. I've never been able to change the boot choices on a boot floppy with LILO installed, but it's easy to do with grub. Setup:
grep -E '^[^#]' filename .Yes, those are 2 circumflexes between singlequotes grep -i -l myserver.com /etc
You can get a listing of all the files in /etc/ that contain the string myserver.com with this command.
timeout 10
color black/cyan yellow/cyan
i18n (hd0,6)/boot/grub/messages
keytable (hd0,6)/boot/us.klt
default 0
title man71 (Mandrake
7.1 in on hda7, which is (hd0,6) to grub)
kernel (hd0,6)/boot/vmlinuz-2.2.15-4mdk root=/dev/hda7
initrd (hd0,6)/boot/initrd.img
title failsafe
kernel (hd0,6)/boot/vmlinuz root=/dev/hda7 failsafe
initrd (hd0,6)/boot/initrd.img
title dos root (hd0,0)
(if you are dual booting
with Windows 98)
makeactive
chainloader +1
title floppy
root (fd0)
chainloader +1
H
hdparm -i /dev/hda will give info on the first hard disk, including chs info.
Home pages - Add user home pages
/etc/htpd/conf/srm.conf has a line in it that allows you to define a UserDir, the default folder for the web browser. Out of the box, Red Hat is configured for a directory called public_html. Put a folder in each user's folder by that name. Inside, the default home page is index.html. MAKE SURE THE FOLDERS AND FILES HAVE READ AND EXECUTE PERMISSIONS FOR ALL DIRECTORIES!
By default, Red Hat gives you the html source and not the formatted page if the page is named *.htm. Add htm to /etc/mime.types to remedy this. Afterward, run
kill -HUP `cat /var/run/httpd.pid` #I'm getting this from /home/httpd/html/manual/FAQ.html (#57)
Hostname - Type hostname by itself to get the hostname of the machine. This info is stored in:
You can also set a hostname for Apache to respond to in its conf files.
Here, FORM /FORM should be in brackets, and INPUT TYPE TO name" should also, nested inside.
FORM
METHOD="POST/GET" ACTION="path/cgi-bin/script"
INPUT TYPE="SUBMIT/TEXT/RADIO/CHECK/PASSWD/RESET" NAME="some_name" VALUE="some_value" (Adding a VALUE="some_value" puts default text in a text box.)
SELECT by itself (not as part of an input tag) gives a pop-up menu.
/FORMWith TYPE="text" you can add SIZE="n" and MAXSIZE="n' within the brackets. The default size is 20.
For RADIO, you should make with the same NAME but different VALUEs. Add CHECKED to the one of them to be the default.
I
1) Download and unpack the tar ball, cd into the IlohaMail directory.
e.g.
$tar xzf IlohaMail-version.tar.gz
$cd IlohaMail-version2) Inside the dir created, there's another one called IlohaMail. Move the IlohaMail directory to any location on your hard drive. It is recommended that you place all files outside the document root, however, with version 0.7.10, it is safe to install inside the document root.
e.g.
$mv IlohaMail /www/IlohaMail3) Add an "Alias" directive in your httpd.conf file, and point it to the
IlohaMail/source directory.
e.g.
Alias /webmail /var/www/html/IlohaMail/source (or wherever it is)you also need to add:
<Directory "/var/www/html/IlohaMail/source/"> (or wherever you put it)
options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>to get it to work.
3b. If you do not have access to the httpd.conf file, you may also create
a symbolic link in your document root.
e.g.
$ln -s /www/IlohaMail/source {$DOCUMENT_ROOT}/webmail4) Create necessary directoriesand change permissions. Here's a script you inside IlohaMail/. Just make it executable.
#!/bin/bash
mkdir users sessions uploads cache
chmod 700 users sessions uploads cache
chown apache:apache users sessions uploads cache
You have to look in httpd.conf to see what user apache runs as. SME runs as www:www.
7) Find this in httpd.conf:
<IfModule mod_dir.c
DirectoryIndex index.html --> add index.php
</IfModule>and add index.php so that Iloha will open automatically.
8) Restart Apache
9) Start ipop3d by going into /etc/xinetd.d/ipop3 and changing disable = yes to
disable = no10) Start imap by going into /etc/xinetd.d/imap and changing disable = yes to
disable = no11) Apache will keep telling you you don't have permissions to access /webmail if ipop3d isn't running, so to get xinetd to reread its config
# /etc/init.d/xinetd reload12) IlohaMail/conf/login.inc is where you can hard code the server name for convenience and hide any login fields you want to hide. There is also a setting for the default language if one is not specified and set the auto-append to only the domain in case it's putting the server hostname and domain after the @. Of course, this is set in the prefs anyway.
Try:$default_host = "localhost"
$hide_host = 1;
$hide_protocol = 1;
$hide_rootdir = 1;
$hide_lang = 0;
13) MySQL backend - IlohaMail/conf/mysqlrc.php is where you put in the info for your mysql tables. You can see what the names of the backend tables are there.
Use this script to set them up automatically. Change the database-specific info to yours, upload it to the DocumentRoot, change it from .html to .php, and make it executable. These tables can be found in IlohaMail-0.x.x/MySQL/sql.
14) Go to IlohaMail/conf/mysqlrc.php and set
$mysql_host="";
$mysql_user="";
$mysql_password="";
$mysql_db="";
to your information.
Also uncomment $mysql_log = "user_log";
while in mysqlrc.php.15) IlohaMail/conf/conf.inc is where you set IlohaMail to actually use the MySQL backend instead of files. Change the
$backend = "FS"; to $backend = "MySQL";
16) IlohaMail/conf/defaults.generic.inc is where you set user@hostname.domainname.com to user@domainname.com.
17) IlohaMail/conf/login_title.inc is where GOL set the fancy login page.
Inittab
Change default init level by hand
edit /etc/inittab
original line- id:3:initdefault:
edit to- id:5:initdefault:Run /sbin/telinit q to reread inittab after editing
IPCHAINS - (from Redhat-install-list) To block a particular URL using IPCHAINS you need to use input and output rules. This will block from within and from outside as well:
/sbin/ipchains -A input -i $your_interface -p tcp -s $ip_addr_source -d $ip_addr_dest -j DENY
/sbin/ipchains -A output -i $your_interface -p tcp -s $ip_addr_source -d $ip_addr_dest -j DENYThe downside to this is that you will be adding alot of IP's in future needs as the number of sites you want to restrict access too grows... I would use a script that builds the rule set from a file that holds the restricted site access.
read the man pages on ipchains for further details. To check a rule use:
ipchains -C input -p tcp -s $source $port_num -d $dest $port_dest -i
$your_interface
ipchains -L -v to get a verbose listing of your firewall
To block a whole subnet from accessing your box:
iptables -A INPUT -s 221.218.105.0/24 -j DROP
#!/bin/shdepmod -a
modprobe ip_masq_ftp
modprobe ip_masq_raudio
echo "1" > /proc/sys/net/ipv4/ip_forward
echo "1" > /proc/sys/net/ipv4/ip_dynaddr #for ppp connections
echo "1" > /proc/sys/net/ipv4/always_defrag
ipchains -P forward DENY
ipchains -A forward -s 192.168.1.0/24 -j MASQ
/etc/rc.d/rc.firewall
Make sure your clients have your Linux box as their gateway.
(RH7.3) /etc/sysctl.conf has a line in it
net.ipv4.ip_forward = 1 ...that turns on IP forwarding. It just does this:echo "1" > /proc/sys/net/ipv4/ip_forward ... which you can also do manually.
J
Client /etc/fstab
/pentium:/ /mnt/pent nfs soft,bg 0 0
(pentium was the server's name - change to your situation)
Server /etc/exports
/ pentium2 (rw,no_root_squash)
(pentium2 was the client's name - change to your situation)
On the command line
mount pentium:/ /mnt/pent
After adding new fonts to Linux
After adding free fonts and sharefonts to my system then added the following to my startup file, .bashrc
xset fp+ /usr/X11R6/lib/X11/fonts/freefont
xset fp+ /usr/X11R6/lib/X11/fonts/sharefont
xset fp rehash
Japanese on Linux (Linux list)
You should install freewnn and kinput2.
Then do 'export LC_ALL=ja_JP" in your shell before running the desired application. You should be able to input japanese into netscape, mozilla (some builds don't work for me), gnome, kde, kterm, and so on.
You should also read the manpages, some relevant howtos and the tlug archieves if things don't work.
LC_ALL=ja_JP.eucJP is better than that.
And on rh 7.x, canna and skk are also available.
K
uname -n will echo the machine name
uname -r prints out the kernel version
uname -a prints out everythingsource code is in /usr/source/linux
Read step by step how to do a kernel on page 171 on The Magic Decoder Ring
All your Kmail stuff is in /root/Mail If you want to put the mail from two different systems together, try cat /mnt/hda8/root/Mail/inbox >> /root/Mail/inbox for example.
You can edit the menus with kmenuedit
L
SME changes the partition labels on reinstalls, and can fail to boot if the label in /etc/fstab doesn't fit reality.
LILO - Multiple flavors of Linux on the same disk. (from Steve Litt's site)
Linux does not read the /etc/lilo.conf file at boot-up. It only reads the MBR. LILO's job is to write the lilo.conf file and write it to the MBR.
To boot multiple flavors or installations of Linux from the same HD:
# Global parameters
[global]
workgroup = WORKGROUP
netbios name = LINUX80
server string = I'm Pentium 3
security = SHARE
wins support = yes
encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd
[share]
path = /share
read only = No
guest ok = Yes[html]
comment = Apache document root
path = /var/www/html
read only = No
guest ok = Yes
Logon message - It's probably best to just write it on the outside of the hard disk, but if you want to write a message to yourself about a system you're testing at logon just put it in /etc/motd.
/etc/issue is where the message that is displayed at the start of a telnet logon is kept. It doesn't replace the "Red Hat x.x on an i686" message but rather comes up after logon.
ls - some things you can do with ls
M
Macintosh - Change Server Name in Macintosh Chooser
You can change the name of the server that shows up in the Macintosh chooser by changing the line
ATALK_NAME=$HOSTNAME to ATALK_NAME="To your folder" or something like that.
Mirroring- Get a partition ready for mirroring
fdisk /dev/hdx Then make the partition. Format it with
mke2fs /dev/hdxx It automagically figures everything for you.
Mount hdxx in /backup
tar -cf - /$1 | (cd mnt/backup ; tar -xvpf -) with each directory as /$1 will mirror them over.
Meaning: using Tar, Create File named - out of /$1 and |pipe it to /backup, unpacking it with tar Xtract Verbosely keeping same Permissions the file named -.
/lib/modules/2.0.35(kernel number)/net/lsmod - lists modules
insmod module - installs a module
modprobe module - is a better installer, as it checks for dependencies
rmmod module - removes a module
Mouse - This /etc/sysconfig/mouse makes a USB mouse scroll on RH8 (vmware, at least)
FULLNAME="Generic - 3 Button Mouse (PS/2)"
MOUSETYPE="ps/2"
XEMU3="no"
XMOUSETYPE="PS/2"This /etc/sysconfig/mouse makes a PS/2 wheel mouse scroll on RH8
FULLNAME="Generic - Wheel Mouse (PS/2)"
MOUSETYPE="imps2"
XEMU3="no"
XMOUSETYPE="genericwheelps/2" (XMOUSETYPE="IMPS/2" worked on RH9)
If two tables have columns with the same name, you can differentiate them by using dot notation, i.e.
table1.samecolmnname, table2. samecolumnname
MySQL- Setting up with PHP on a Linux box (RH5.2, 6.0, Man 5.3, 6.0)
1. Download and install mysql from http://mysql.com. At the very least install the latest server, client, and development rpms.
2. Query Apache. You need rpm -i apache-1.3.6-7.i386.rpm
rpm -i apache-devel-1.3.6-7.i386.rpm (This contains /usr/sbin/apxs)
rpm -i freetype-devel-1.2.6.i386.rpm
With Mandrake 6.0 the only thing I needed to put in was the freetype.
3. Try out MySQL by doing the following:
At the command prompt, type mysqladmin create databasename (enter)
mysql databasename (enter). If you get a welcome, you're OK. Get out by entering "quit.".
4. Download, gunzip, and untar the PHP tarball from http://php.net.
5. CD into the PHP directory and build it with:./configure --with-apxs=/usr/sbin/apxs --with-mysql --with-ldap (those are double hyphens)
the ldap part errored out, so I had to delete it and try again. With Apache 1.3.9 or later you can add --with-xml6. Type: make (enter)
make install
After 'make install' you get:/usr/sbin/apxs -i -n php3 libphp3.so
cp libphp3.so /usr/lib/apache/libphp3.so
chmod 755 /usr/lib/apache/libphp3.so6. Go to /etc/httpd/conf/httpd.conf and uncomment these two lines:
LoadModule php3_module libexec/libphp3.so
AddModule mod_php3.c
7. Check to make sure that in /etc/httpd/conf/srm.conf the lines
Addtype application/x-httpd-php3 .php3
Addtype application/x-httpd-php3-source .phps
are not commented out.
8. Restart Apache with: /etc/rc.d/init.d/httpd restart
9. Test it. Put a file in your document root directory /home/httpd/html with the single line:<?phpinfo()?>
and name it info.php3. Then load it up in your browser: http://your.machine/info.php3 You should see a nice summary page showing all sorts of information about your setup.
The data base files go in /var/lib/mysql.
The executables are in /usr/bin.
MySQL - Installing it as a binary - Never tried this but got it somewhere...
Use the mysql.tar.gz file on the MYSQL_PHP CD
Untar it into /usr/local. It will make its own folder
The basic commands you must execute to install and use a *MySQL* binarydistribution are:shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cd /usr/local
shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
shell> ln -s mysql-VERSION-OS mysql
shell> cd mysql
shell> scripts/mysql_install_db
shell> chown -R root /usr/local/mysql
shell> chown -R mysql /usr/local/mysql/var
shell> chgrp -R mysql /usr/local/mysql
shell> chown -R root /usr/local/mysql/bin/
shell> bin/safe_mysqld --user=mysql &
You can add new users using the `bin/mysql_setpermission' script if you
install the `DBI' and `Msql-Mysql-modules' Perl modules.
Install php4 and MySQL from rpms - Just slop in the mysql and php rpms. It's no big deal. Then to get it to work, I had to put these in /httpd.conf flush left:
Near the top:
AddModule mod_php4.c
Farther down:
AddType application/x-httpd-php .php4 .php3 .phtml .php
AddType application/x-httpd-php-source .phpsI know it looks like they're already there as contingencies, but put these lines in anyway.
Common commands and tasks in MySQL 3.23.35
In the install directory:
./safe_mysqld &
(installs some default databases) That's a dot-slash at the beginning.
mysqladmin -u root password
'new-password' (changes password)
mysql -u root -p <enter>
(starts it then add password)
show databases; (does just that)
create database <database -name>; (does just that)
use <database-name>; (enters a database)
create table <table-name> (then you need to describe it)
describe <table-name>; (shows need info about table)
In /usr/bin you can issue ./mysqlshow -u root -ppassword databasename and
it will show you all the tables without ever logging in.
mysqladmin status
mysqladmin version
mysqladmin drop db1 - deletes a database named db1
mysql db1 - enter the data base for editing
mysql> CREATE TABLE tb1( - creates table named "table1." One space between each element.
-> columnname1VARCHAR(25) [not null], - creates the columns to accept up to 25 variable characters. "not null" disallows empty cells.
-> columnname1VARCHAR(25) - in length. There is one space between elements.
> );
Query OK, 0 rows affected (0.00 sec)
Create a table from a file (Thanks to Graeme Merrall at Webmonkey)
1. Create data base with mysql admin
mysqladmin -u root create mydb
2. Put all the sql commands into a text file, such as:
CREATE TABLE tablename( id tinyint(4) DEFAULT '0' NOT NULL AUTO_INCREMENT, first varchar(20), last varchar(20), address varchar(255), position varchar(50), PRIMARY KEY (id), UNIQUE id (id));
INSERT INTO employees VALUES (1,'Bob','Smith','128 Here St, Cityname','Marketing Manager');
3. Save this file to /var/lib/mysql/somefilename
4. On the command line, issue: mysql -u root mydb < somefilename
To see the table you've created type:
Insert statements - to put data in a table:
mysql> insert into employee
-> (columnname1, columnname2)
-> values ('Luke', 'Duke');
Query OK, 1 row affected (0.00 sec)
Change data in tables
Substitute data with "update"
update tablename set columnname = 'somethingdifferent' where othercolmn = 'someidentifier';
Relational operators
| = | Equal |
| <> or != | Not equal |
| < | Less than |
| > | Greater than |
| <= | Less than or equal |
| >= | Greater than or equal |
To add a column from one table to another table:
select distinct table1.*, table2.columnname from table1, table2 where table1.columnname = table2.columnname
% is a wildcard for several characters in WHERE statements.
_ is a wildcard for one character in WHERE statements."like" could also be "="
N
Name - computer name The computer keeps its name in:
192.168.1.1 pentium.mydomain.cxm pentium
netstat -r gives you routing info. Netstat -i shows you the received and transmitted stuff that you can get from KPPPload.
(Man 7.1, RH 6.2) Networking setup - Your networking in set up in these main files:
1) /etc/conf.modules lists the modules for the net cards. If you want to know what drivers are loaded for eth0, eth1, etc, look in /etc/conf.modules:
alias eth0 3c509 tells you that eth0 is a 3 Com card.
alias eth1 epic100 - SMC card
alias eth2 tulip - the Netgear card
alias eth3 via-rhineOf course, the modules have got to really be there, though. You will find the modules themselves in /lib/modules/kernelname/net/ so if you're not sure what to call them, look in there.
2) If you want toassign IP numbers to netcards by hand, put them in /etc/sysconfig/network-scripts/ifcfg-ethx
Here's an example of ifcfg-eth0:
DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.1.1
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes3) /etc/sysconfig/network has this info:
NETWORKING=yes
FORWARD_IPV4=yes
HOSTNAME=linux.mydomain.cxm
DOMAINNAME=mydomain.com
GATEWAY=192.168.1.254
GATEWAYDEV=eth0
If you want to add IP, network, and routing info by hand on the command line, you can enter:
route add -net 192.168.1.0 netmask 255.255.255.0 dev eth0
To add the router address, enter:
route add default gw 192.168.1.254
4) What you're doing, though, is editing /etc/sysconfig/static-routes. You can just add:
eth0 net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.254
there by hand and it will survive a reboot.
Hostname
To add a hostname on the fly, enter:
hostname linux.mydomain.cxm
5) To have it survive a reboot, put in /etc/hosts:
192.168.1.2 linux.mydomain.cxm linux
6) Put the name(s) of your nameserver(s) in /etc/resolv.conf:
search mydomain.cxm
nameserver 192.168.1.2 #the linux box itself
nameserver 143.90.130.22
NICs - You can set up a network card on the command line using ifconfig:
If you have an ISA card and you need to add particulars, you can make it
Next add the local route:
Then add the gateway:
NTFS mount - you can mount ntfs partitions with mount -t ntfs /dev/hdxx /mnt/xx. They will be read only, though.
Run nysysv --level 35 to edit edit which services start in which renlevels. If you don't do the second part, it just edits the runlevel you are currently at.
P
Path - You can add a directory to your path in /root/.bashrc
You can add something (a dot for the PWD or any other path) by typing: PATH=$PATH:. (note the trailing dot)
export PATHThis will only be affective for this session. To make it permanent:
For one user, edit the user's .bash_.profile file
Make it say: PATH=$PATH:$HOME/bin:. <- note the colon and period on the end
For all users edit /etc/profile
Quick Install:
1.Untar or unzip the distribution (be sure to unzip the subdirectories): tar xzvf phpMyAdmin_x.x.x.tar.gz
2.Open the file config.inc.php3 in your favorite editor and change the values for host, user and password to fit your environment. Have a look at Configuration section for an explanation of all values.
I just did:$cfgPmaAbsoluteUri = 'http://linux.mydomain.cxm/phpMyAdmin-2.2.3/';
$cfgServers[1]['host'] = 'localhost'; // MySQL hostname
$cfgServers[1]['user'] = 'root'; // MySQL user
$cfgServers[1]['password'] = '*******'; // MySQL password (onlyneeded with 'config' auth)3.It is recommended that you protect the directory in which you installed
phpMyAdmin (unless it's on a closed intranet, or you wish to use http or
cookie authentication), for example with HTTP-AUTH (in a .htaccess file). See
the FAQ section for additional information.
4.Open the file
http://linux.mydomain.cxm/phpMyAdmin-2.2.3/index.php in your browser. phpMyAdmin
should now display a welcome screen and your databases, or a login dialog if
using http or cookie authentication mode.
ping - disable You can disable a box's responding to ICMP pings with
/bin/echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all
Ports - Some of the more famous ports. You can find a more complete list under Windows \winnt\system32\drivers\etc\services.
service port icmp ftp 21/tcp ssh 22/tcp telnet 23/tcp smtp 25/tcp http 80/tcp pop3 110/tcp ldap 389/tcp netbios-ns 137/tcp netbios-ns 137/udp netbios-dgm 138/udp https 443/tcp https 443/udp pptp 1723/tcp
Predefined ports are listed in /etc/services
See what ports are currently being used by what daemons -
netstat -nape
pppoe - PPP Over Ethernet is what you use to connect to the 'Net with ADSL.
# If you don't want the
GUI:
rpm -Uvh rp-pppoe-3.0-1.i386.rpm
/usr/sbin/adsl-setup
# If you do want the GUI
rpm -Uvh rp-pppoe-3.0-1.i386.rpm rp-pppoe-gui-3.0-1.i386.rpm
/usr/bin/tkpppoe
Once the rpm goes in, here's the setup. It's straight from roaringpenguin's info.
1. Set up your Ethernet
hardware
First, make sure the Ethernet card you intend to use with the modem is
visible to the Linux kernel.
DO NOT assign an IP address to the Ethernet card. DO
NOT configure the
card to come up at boot time.
You can do this quickly and easily using netcfg.
2. Configure various files
Several files need editing.
The easiest way to do this is to run
the following command as root:
adsl-setup
Answer the questions and
you should be all set. If you want to know what
goes on behind the scenes, continue reading this document. If you don't
care and your connection works, stop reading. :-)
3. Edit pap-secrets
-------------------
Edit the "pap-secrets"
file, inserting your proper user-ID and password.
Install the file (or copy the relevant lines) to /etc/ppp/pap-secrets.
Your ISP may use CHAP authentication. In this case, add the line to
/etc/ppp/chap-secrets.
4. Edit /etc/ppp/pppoe.conf
The file /etc/ppp/pppoe.conf contains configuration information for the
ADSL connection. You need to edit the following items:
- Change ETH=eth1 to the
correct Ethernet device for your modem.
- Change USER=bxxxnxnx@sympatico.ca to your proper ADSL user-ID.
Don't edit any of the other settings unless you're an expert.
5. Set up DNS
If you are using DNS servers supplied by your ISP, edit the file
/etc/resolv.conf to contain these lines:
nameserver ip_addr_of_first_dns_server
nameserver ip_addr_of_second_dns_server
For example:
nameserver 204.101.251.1
nameserver 204.101.251.2
6. Firewall your machine
MAKE SURE YOU FIREWALL YOUR MACHINE. A sample firewall script is given
in the shell script "firewall" (/etc/pppfirewall-masq). To install the script:
a) Copy it to /etc/rc.d/init.d/firewall
b) Type: chkconfig firewall on
c) Start the firewall: sh /etc/rc.d/init.d/firewall start
7. Bring up the connection
at boot time
On a Red Hat system, the installation procedure should have installed
a script called /etc/rc.d/init.d/adsl. To bring up the connection
at boot time, just type this command as root:
chkconfig --add adsl
On non-Red-Hat systems,
add this line to the end
of /etc/rc.d/rc.local:
/usr/sbin/adsl-start
8. Configure LAN Hosts
----------------------
If you have a LAN behind
the firewall, you have to lower the TCP
maximum segment size from the normal 1460 to 1452 (or better, 1412.)
You have two options: Either set the MTU of all the interfaces on
other hosts on the LAN to 1452, or use the "-m 1412" option to pppoe.
The "-m" option for pppoe is far simpler and makes it easier to add
hosts to the LAN, but consumes some extra CPU time.
If you want to manually configure the LAN hosts, here's how:
In Linux, use: "ifconfig
eth0 mtu 1452". For best results, put this
in an /etc/rc.d/rc.local script.
For Windows, machines,
see http://lan.cns.ksu.edu/OS/WIN95/slip95.htm.
Set the MaxMTU to 1452.
9. Commands to control
the ADSL link
As root, bring up the link by typing: adsl-start
As root, bring down the link by typing: adsl-stop
Getting printer to work with RH 7.2 is a real pain in the butt, but I got it.
(Later I discovered that hpijis is an rpm)
processes
ktop at the command line will give you the graphic representation of the top processes
Say a program called gFTP is not responding. To find its pid, issue:
ps ax | grep gFTP
It will tell you its pid. If it's, for example, 879, issue:
kill 879
If that doesn't do it, issue:
kill -9 879Start a process with & after it to start it in the background.
fg will bring it to the foreground.
CTRL-C will stop it in the foreground but not int he background.
CTRL-Z will stop it temporarily.
bg will send it to the background.
R
rc.d - add S symlinks to start services (from Jim Titsler's reply on-line)
The easiest way to create appropriate symlinks in rcx.d is to use 'chkconfig':
checkconfig httpd on (which will create an S85httpd symlink, based on the magic line
at the top of /etc/rc.d/init.d/httpd).Or, for a GUI, by using 'ntsysv' to control which services are automatically started.
mkdir -p /etc/e-smith/templates-custom/etc/php.ini/
cd /etc/e-smith/templates-custom/etc/php.ini/
cp /etc/e-smith/templates/etc/php.ini/40DataHandling .edit 40DataHandling and change register_globals = off to on
expand-template /etc/php.ini
/etc/rc7.d/S86httpd-e-smith restart
Run fsck -t ext2 /dev/hdxx
RealPlayer8 (Live365) - After installing the RealPlayer8 rpm in the usual way, you have to find it for Live365. It the location of the executable is /usr/lib/RealPlayer8/realplay.
The boot disk you created during the installation is not a root disk, meaning there's no root filesystem for the kernel to mount at boot. The boot disk only contains a Linux kernel, which allows you to boot into your system if anything unfortunate ever happens with your kernel but not your filesystem. The boot disk works if you just hit enter at the boot prompt.
To use a rescue disk, you must make one from the rescue.img in the /images directory of your first CD (or from a copy on the net somewhere).
Under Linux, put a blank floppy in the drive and as root issue:# dd if=rescue.img of=/dev/fd0 bs=1440k -or-
# cat rescue.img >/dev/fd0Then you can try a rescue boot by typing 'rescue' at the boot prompt of the boot diskette and inserting the rescue diskette when it asks for it.
route - Type "route" by itself to see the routing table
If you want to add IP, network, and routing info by hand on the command line, you can enter:
route add -net 192.168.1.0 netmask 255.255.255.0 dev eth0
To add the router address, enter:
route add default gw 192.168.1.254
4) What you're doing, though, is editing /etc/sysconfig/static-routes on older systems. You can just add:
eth0 net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.254
there by hand and it will survive a reboot.
On RH8, /etc/sysconfig/network should say
NETWORKING=yes
HOSTNAME=rh8
GATEWAY= 192.168.1.254
RPM - If you you want to see all the options spewed to STDOUT, just type rpm.
Queries
Installing and uninstalling
Add the letter p to the options if the package is not installed yet.
Verify messages - rpm -Va checks to see that all rpms are installed correctly
The format of the output is a string of 8 characters, a possible "c" denoting a configuration file, and then the file nane. Each of the 8 characters denotes the result of a comparison of one attribute of the file to the value of that attribule recorded in the RPM database. A single "." means the test passed. The following characters denote failure of certain tests:
rpmverify (script) - This script will go through and check all your rpms. It will then create a file /tmp/rpmverify.out telling which ones have been changed. Uses rpm -V.
#!/bin/bash
for rpmlist in `rpm -qa | sort`
do
echo " =========== $rpmlist ============"
rpm -V $rpmlist
done > /tmp/rpmverify.out
You can change the levels that services run at by dragging them over using ksysv.
/etc/rc.d/rc.local is the last script to run at bootup. If you want anything to run last, put it here. If you want it to set the hostname to linux.mydomain.cxm, put hostname linux.mydomain.cxm in there.
S
Samba printing (from Redhat-install-list)
(Problem):I have got Samba up and running and can connect drives both ways between my Win98 and RH6.0 boxes and connect a printer to the RH that is physically attached to the Win98 box. Everything looks Ok except I can't see anything in my Network Neighbourhood. Below is a copy of my /etc/smb.conf.# Samba config file created using SWAT
# from aragorn.home (192.168.1.2)
# Date: 1999/12/04 08:34:04
# Global parameters
workgroup = LOTR
netbios name = ARAGORN
encrypt passwords = Yes
log file = /var/log/samba/log.%m
max log size = 50
socket options = TCP_NODELAY
printcap name = /etc/printcap
dns proxy = No[homes]
comment = Home Directories
read only = No
browseable = No[printers]
comment = All Printers
path = /var/spool/samba
print ok = Yes
browseable = No[Root]
comment = Root directory
path = /
read only = NoANSWER:"Seeing" the shares is dependent upon your samba.conf file. You need to assign a browse master to control this. In turn it should be Linux/Samba as I indicated in my message to you. In my case I opted out for using Samba as a domain LOGIN server, which simplifies things if you are not using NT as a PDC. Samba then controls what the users see...
Double quotes remove white space, but the dollar sign $, backslash \, and back quotation marks ` retain their shell meaning:
greeting="hello there $LOGNAME" still takes LOGNAME from the environment variable.
\ will also remove white spaces, e.g. greeting=hello\ there will also assign "hello there" to variable "greeting." The \ removes the special meaning from the character it precedes.
Single quotes will remove the special meaning of the $.
greeting='hello there $LOGNAME' will echo the dollar sign.Multiple command line commands separated by a semi-colon are executed in sequence. Separated by an ampersand, they are run concurrently.
Curly braces: echo Hello $LOGNAMEski gives you only Hello , because it can't find a variable ending in ski. You can end the variable by using curly braces:
# echo Hello ${LOGNAME}
Hello Glennski.
Set a variable by putting a value to the right of the equal sign:
# BIGBOY=Glenn
# echo Hello $BIGBOYHello Glenn
Unset the variable with the unset command
# unset BIGBOY
#echo Hello $BIGBOY#
Want to test a script without the hassle of making it executable and in your path? Just type
sh thescriptname
The test command's file
operators
| Operator | Meaning (Copied from Linux Unleashed) |
| -d filename | Returns true if "filename" is a directory |
| -f filename | Returns true if "filename" is an ordinary file |
| -r filename | Returns true if "filename" can be read by the process |
| -s filename | Returns true if "filename" has a non-zero length |
| -w filename | Returns true if "filename" can be written by the process |
| -x filename | Returns true if "filename" is executable |
| Command | Meaning (Copied from Linux Unleashed) |
| ! expr | Returns true if expr is not true |
| Expr1 -a expr2 | Returns true if expr1 and expr2 are true |
| Espr1 -o expr2 | Returns true if expr1 or expr2 is true |
| Variable | Use (Copied from Linux Unleashed) |
| $# | Stores the number of command line arguments that were passes to the Shell program |
| $? | Stores the exit value of the last command that was executed |
| $0 | Stores the first word of the entered command (the name of the shell program) |
| $* | Stores all the arguments that were entered on the command line ($1 $2 . . . ) |
| "$@" | Stores all the arguments that were entered on the command line, individually quoted ("$1", "$2" . . .) |
| Plain English |
|
| If the last command was successful | if [ $? = 0 ] ; then |
| If there is such a file named testfile | if [ -f testfile ] ; then |
| If there is such a directory named dir | if [ -d dir ] ; then |
| If the file exists and contains something | if [ -s testfile ] ; then |
| If the thing you typed on the command line as an argument is not a directory | if [ ! -d "$1" ]; then |
| If the last command was successful, carry on. Otherwise, echo ". . . ." | if [ $?
-eq 0 ]; then : else echo " . . . " |
A shell script to add users automatically from a list in the same directory.
users=`cat ./users`
for u in $users
do
echo "adding User .... ${u}"
useradd ${u}
passwd ${u}
done
A script to remove users and their files one by one from the command line
#!/bin/sh
echo -n "Enter username to be deleted: "
read user #What comes after the read becomes the variable for what was entered
if [ -z "$user" ];then #I think -z means "=0"
echo "No name entered. Exiting."
exit 0
else
echo "Removing user $user ..."
userdel $user
rm -rf /home/$user
rm -f /var/spool/mail/$user
echo "ok"
fi
Remove viruses from a directory
#!/bin/bash
virii=`cat ./virii`
for v in $viriido
rm -rf $v
done
Server Side Includes on Apache - Enable
1. In /etc/httpd/conf/access.conf, enable includes in a directory of your choice:
<directory /some/path/directory_for_shtml>
options includes followSymLinks indexes
</directory>
2. In /etc/httpd/conf/srm.conf, add the line
Add type text/x-server-parsed-html .shtmlIf you can afford to have Apache parse every document, just make it .html
Signatures in Kmail with fortune - If you want to have a signature line in Kmail with a rotating cute phrase:
1. Make a /root/.signature file and put what you want in it
2. Touch another file called /root/.sig
3. Put this in your /root/.bashrc file:cat /root/.signature > /root/.sig (This puts the signature file into another one so fortune doesn't overwrite it)
/usr/games/fortune >> /root/.sig (This appends the fortune cookie. )-Optional-
/usr/games/fortune > /etc/motd (Message Of The Day gives the logon message)echo $PATH|grep -q /sbin || export PATH=$PATH:/sbin:/usr/sbin
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
You can see the aliases in .bashrc by typing alias at a shell prompt.
SMB password (from the old days)
cat /etc/passwd | mksmbpasswd.sh > /etc/smbpasswd
chmod 600 /etc/smbpasswd
Then: smbpasswd (username) Give the user a new password
/etc/rc.d/init.d/smb start (stop) (start) (restart) will do it
A SIMPLE samba example with no security:
[global]
wins server = a.b.c.d (optional)
workgroup = WORKGROUP (or whatever you call yours -could be
the domain, too)
server string = this is only a comment, so say anything or
nothing
netbios name = put what you want Linux toshow up as, such
as "Linux"
security = share
[share] (regardless
of what you named your directory on Linux, this makes it show up on the
network as \\linuxhostname\share)
path = /real_directory_name (e.g.
/share in this example)
writeable = yes
guest ok = yes
ENTER password for glenn
New SMB password: <password>
Retype new SMB password for user glenn: <password>
Password changed for user glenn
A PASSWORD PROTECTED samba example:
[global]
wins server = 192.168.1.2 (e.g. NT 4 PDC)
workgroup = DOMAIN (Domain name)
server string = samba test server
netbios name = Linuxbox
security = server
password server = PENTIUMSERVER
encrypt passwords = yes
[firstshare]
comment = Have a nice day
path = /samtest
writeable = yes
guest ok = yes
valid user = glenn gihong
Add this to restrict Samba connects to the internal network.
interfaces = 192.168.1.1/255.255.255.0
bind interfaces only = yes
socket address = 192.168.1.1
allow hosts = 192.168.2.0/255.255.255.0 192.168.1.0/255.255.255.0SWAT
Sendmail (additional info is in /usr/share/docs/sendmail/ after you install the sendmail-docs rpm). You can also check http://www.sendmail.org/faq/ )
Here's an almost ready to use sendmail.mc file
/etc/sysconfig/sendmail should have it run as a daemon. If you put it in from source you'll have to enable it. Mine said:
1. Make sure the sendmail, sendmail-cf, and sendmail-doc RPMs are all in. The first two are on disk 1 and the docs on 3 (RH7.3)
DAEMON=yes
QUEUE=1h (don't know which is more powerful, this one or the one in sendmail.mc)
2. Make sure pop3 is in. Pop3 is ipop3d. run which ipop3d. It is installed with the imap rpm.
3. Make sure ipop3d is good to go by checking /etc/xinetd.d/ipop3 and making sure that
disable = yes is changed to disable = no.
You can do the same with /etc/xinet.d/imap and imaps if you have the SSL module in.
4. You can restart with /etc/rc.d/init.d/xinetd restart service sendmail start will start sendmail.
5. Put MX records in your zone files for your DNS zone files. I addedIN MX 1 linux.mydomain.cxm. <- 1 is the pecking order of the mail and there is a trailing dot. There is a space before IN.
redhat-config-bind made it look like this, with an @ mark first.
@ IN MX 1 hostname.domainname.xx.
6. /etc/sendmail.cf has the line
Cwlocalhost in it by default. Change it to Cwyourdomain. I made mine
Cwmydomain.cxm -and-
Cwpentium.cxm ---Also add
DMmydomain.cxm (couldn't find this on RH8's Sendmail)Marcel, however, says to change the line DjSw.Foo.COM to DJmydomain.cxm
7. Next, he says to change /etc/mail/local-host-names and add aliases for your machine, such as
mail.mydomain.cxm
mydomain.cxm
localhost
8. After restarting (/etc/rc.d/init.d/sendmail restart) it should work.
9. If you want to alias some email accounts, just edit /etc/mail/aliases
If you add:
glenne: glenn
glennski: glenn --Then email addresses to those will go to user glenn, too.
10. run newaliases on the comand line to add them.
11. You can test your configuration by running:
sendmail -bt <enter>
3,0 username
Ctrl-d gets you out.sendmail.mc is in /etc/mail/. It is the file used to produce /etc/mail/sendmail.cf.(In < RH8 it was /etc/sendmail.cf)
- Use sendmail.mc to produce sendmail.rc by running it through the m4 processor.
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.rc
- anything in sendmail.mc with a dnl (delete to new line) in front of it is a comment. If you want to add that, take off the dnl and run it through m4.
- define(`something', `somethingelse') means "print the second one in the sendmail.cf," so define(`confTO_QUEUEWARN', `4h')dnl
means to set the TO_QUEUEWARN value to 4 hours in sendmail.cf. Actually 4 hours is the default, though. You've seen the "I haven't been able to send your mail for 4 hours" message.Mick Bauer in "Hardening Sendmail" lists these steps:
Stuff in blue recommended by Mick Bauer for security
1. Enable needed features in sendmail.mc. This is a big step.
divert(-1)
include(`/usr/share/sendmail-cf/m4/cf.m4')
VERSIONID(`linux setup for Red Hat Linux')dnl
OSTYPE(`linux')
dnl 8:12 is the user:group number for user "mail" in /etc/passwd.
define(`confDEF_USER_ID',``8:12'')dnl
dnl Definitions have to come before the FEATURES associated with them
dnl The next one will let sendmail autorebuild needed databases
define(`confAUTO_REBUILD')dnl
define(`confTO_CONNECT', `1m')dnl
define(`confTRY_NULL_MX_LIST',true)dnl
define(`confDONT_PROBE_INTERFACES',true)dnl
define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')dnl
dnl This goes with feature redirect
define(`ALIAS_FILE', `/etc/aliases')dnl
define(`UUCP_MAILER_MAX', `2000000')dnl
define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl
define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
define(`confAUTH_OPTIONS', `A')dnl
FEATURE(`no_default_msa',`dnl')dnl
dnl SendMailRestrictedShell restricts the .forward files users can put in their $HOME
FEATURE(`smrsh',`/usr/sbin/smrsh')dnl
dnl define(`confSAFE_FILE_ENV',`/var/mailjail')dnl
FEATURE(`mailertable',`hash -o /etc/mail/mailertable.db')dnl
FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable.db')dnl
dnl redirect lets you define aliases in /etc/alias
FEATURE(redirect)dnl
FEATURE(always_add_domain)dnl
dnl use cw_file makes sendmail read local_host_names file
FEATURE(use_cw_file)dnl
dnl use_ct_file makes sendmail read trusted_users_file
FEATURE(use_ct_file)dnl
dnl The '-t' option will retry delivery if e.g. the user runs over his quota.
FEATURE(local_procmail,`',`procmail -t -Y -a $h -d $u')dnl
dnl /etc/access.db is a list of who can relay through this machine.
dnl Try makemap -C sendmail.cf -v hash access.db < access to see what it's doing.
FEATURE(`access_db',` -T<TMPF> hash -o /etc/mail/access.db')dnl
dnl blacklist restricts some users who shouldn't get mail from getting it, like "nobody"
FEATURE(`blacklist_recipients')dnl
dnl By default, sendmail won't relay (potentially fake) domains it can't resolve. The feature below that lets you do it should be commented out.
dnl FEATURE(`accept_unresolvable_domains')dnl
FEATURE(`relay_based_on_MX')dnl<Masquerading stuff goes here.>
MAILER(smtp)dnl
MAILER(procmail)dnl
Cwdomainname.cxm2. Set up domain-name masquerading, if needed, in sendmail.mc.
MASQUERADE_AS(`domainname.cxm')
MASQUERADE_DOMAIN(`mail.domainname.cxm')
dnl The above could be (`.domainname.cxm') -dot comes first in a big
dnl setup with multiple servers or just (`domainname.cxm')
dnl exposed user means that even if a whole domain is masqueraded, messages
dnl root show the host they came from
EXPOSED_USER(`root')dnl
dnl All hostnames will be stripped with the following
FEATURE(masquerade_entire_domain)
dnl Not only the header files but also the envelope will be masqueraded
dnl But you won't see this unless you send mail with low level stuff like
dnl command line mail.
FEATURE(masquerade_envelope)Be careful with FEATURE(relay_based_on_MX). If you use it, it will subsitute the MX hostname for your hostname. If mail.mydomain.cxm is the MX, mail sent from host.mydomain.cxm will also be sent as from mail.mydomain.cxm. Can't imagine why you would want this.
Addtionally, Mick recommends this line, which is commented out in above:
define(`confSAFE_FILE_ENV', `/var/mail/mailjail')dnl
If you use it, you must do this to set up a type of chroot environment for sendmail
mkdir -p /var/mailjail/spool/mail /var/mailjail/var/spool/mqueue
cd /var/mailjail
chown -R mail:mail *
chmod -R 700 *3. Run m4 to generate sendmail.cf from sendmail.mc
m4 sendmail.mc > sendmail.cf
4. Configure delivery rules by editing mailertable.
The mailer table lets you route messages addressed a specific host or domain to a particular mail server. You can use the mailertable to address mail to a virtual domain to your mail server.
.mydomain.com smtp:mail.mydomain.cxm
Sendmail doesn't read the test file mailertable; it reads the database. Make it with
Make mailertable.db - run in the /etc/mail directory.
5. /etc/mail/access Configure relay rules by editing access.
Again, /etc/mail/access is a list of allowed relayers. This is pretty important stuff. It should say:
localhost.localdomain RELAY localhost RELAY 127.0.0.1 RELAY 192.168.1 RELAY It's dangerous to put real names in there, because they're so easily forged.
Mick says to make it with: make access.db This uses the included Makefile.
You can also do: makemap -C sendmail.cf -v hash access.db < access to call the makemap program.
In RH 9 I had to do this:chown root access.db
make access.db
chown smmsp access.db as permission was denied otherwise.
6. /etc/aliases Configure local user-aliases by editing /etc/aliases
These take the form
fakename: realname
If you add:
glenne: glenn
glennski: glennThen email addresses to those will go to user glenn, too. Run newaliases on the comand line to add them.
7. /etc/mail/local-host-name. Define all local hostnames in local-host-names.
local-host-names contains synonyms of the smtp gateway, the local server in small setups.
mydomain.cxm
mail.mydomain.cxm
localhost
192.168.1.1
8. service sendmail restart
/etc/default/useradd has the default shell for new users.
Change to:
SHELL=/bin/noshell
to give new users no shell by default.
services -
start/stop You can make services start and stop automatically by using chkconfig. chkconfig --list httpd will tell you at which of the 6 runlevels httpd is to run. Make it start or not run with chkconfig --level <runlevel> <service> off/on. See page 473 of Using Linux.
Ex. chkconfig --level 35 smbd on # This makes samba run at levels 3 and 5
chkconfig telnet on # This starts telnet at the default runlevels
start/stop in RH 7.1 inetd.conf has become /etc/xinet.d and the services are inside. If you change the disable=yes to disable=no and then issue xinetd --restart things should change.ntsysv - In Red Hat 6+ you can get the screen in which you decide what services start on bootup by issuing ntsysv. Run ntsysv --level 35 to effect changes at both run levels.
setuid - Find setuid files on server with this command:
find / -type f \( -perm -4000 -o -perm 2000 \) -ls > /danger.txt
Smoothwall (release .98)
- http://www.e-smith.org/docs/howto/ will help you out.
- You can get a command line prompt by hitting Ctl - Alt - F2
- Hit it with a web browser https://x.x.x.x/server-manager/
Qmail doublebounce to devnull (from sme.swerts-knudsen.com)
mkdir -p /etc/e-smith/templates-custom/var/qmail/control
echo devnull > /etc/e-smith/templates-custom/var/qmail/control/doublebounceto
/sbin/e-smith/signal-event email-update
/etc/init.d/qmail restart/home/e-smith/files/users/<username>/Maildir on 6.x and 7.x:
6.x 7.x This renaming and missing dir has made tarring up and over impossible to move mail from one machine to the other. However, expiramentation tells me that ;Inbox/cur mail tarred over to .Inbox/cur on 7.x will open and read just fine. cur cur ;Inbox .Inbox ;junkmail .junkmail new new ;sent-mail tmp tmp
To get IlohaMail to work on e-smith:
If you cat /etc/httpd/conf/httpd.conf, you will find that there are Aliases. These seem to come from /etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/30WebmailAliases
I added: $OUT .= " Alias /webmail2 /home/e-smith/files/primary/html/ilohamail/source\n ";
I added: $OUT .= " Alias /webmail3 /home/e-smith/files/primary/html/webmail3\n ";and they showed up in /etc/httpd/conf/httpd.conf on reboot.
In /etc/e-smith/templates/etc/httpd/conf/httpd.conf/90e-smithAccess10primary I added:Alias /webmail2 "/home/e-smith/files/primary/html/ilohamail/source"
<Directory "/home/e-smith/files/primary/html/ilohamail/source">
Options Indexes MultiViews
AllowOverride none
Order allow,deny
Allow from all
</Directory>That didn't work either. The logs say that no symlinks are allowed to be followed from the document_root. Don't know how to allow it. (Worked on RH8)
In version .99 of Smoothwall
the WUI is available at :
| https://smoothwall:445 | http://smoothwall:81 |
| https://192.168.1.1:445 | http://192.168.1.1.:81 |
Sort - Use "sort" command to alphabetize lines in a file. Very useful for putting users in password file in order.
source code for kernel is in /usr/source/linux
Control Panel
On the command line, type "control-panel."
Start / Stop eth0 (or whatever)
ifconfig eth0 up (down) will do it
Successful DMZ setup - I set up Smoothwall in a very standard way, nothing special. One thing you need to know is that Smoothwall did not have any DNS or Gateway configured at the time. At IEC I guess the gateway would be the Yamaha router and the DNS would be the AIO and the ISP.
IP: 203.216.85.163
Mask: 255.255.255.248
Gateway: 203.216.85.162 (This seems unnatural to have Net traffic with a
default gateway of Smoothwall, but that's how I had it.)
Go to the WUI for Smoothwall,
then go to Services -> Port Forwarding and put in the following rule:
| Proto | Source port | Destination IP | Destination port |
| TCP | 80 | 192.168.2.2 | 80 |
Loading up a web browser on the client on the red interface (203.216.85.163) and pointing it to http://203.216.85.162 (Smoothwall) produced the page from the server at 192.168.2.2.
sudo - (from http://www.dungog.net/sme/admin.php) Sudo access allows users to execute commands with the permissions of the root account without knowing the root password. This is more desirable than passing around the root password. sudo gives a user root privileges by prefixing the command with sudo
eg. sudo tail /var/log/messages
Either add another partition, fdisk it to swap, run mkswap on it, add it to fstab and mount it, OR create a swapfile. 'man mkswap' gives an example of how to do it using 'dd' to create it. You'll still need to add it to fstab to get it to mount at the time of booting.
Symlink/shortcut/alias
- how to make one
ln -s file1 file2 creates a shortcut to file1 named file2
Network - To configure the network use netcfg
script writes macros. Type script and then follow with anything. It records your keystrokes. End with ctrl-D.
T
tar - the basic syntax for creating tar files is
tar -cf file_name-when-it's_finished file_ or_directories_to_tar_up
Example: If you want to tar and gzip the /etc and /var dirs into a file called backup.tar.gz, you would run this:
tar -czf backup.tar.gz /etc /var (there's a space after tar, -czf, backup.tar.gz, and /etc. You can continue by putting more dirs on the end.
tar does not need a leading hyphen before its arguments. Main things tar does:
- c create
- x extract
- t list - tells you what's in there
- u update - puts in new files or updates existing
- r append - appends to the end of an existing archive
-V - verify that all's right (this is a capital "V")
-G - if you are creating, makes it incrementaltar -tzvf backupfile.tgz >> backuplist.txt would make a list of everything included in a gzipped tarfile and print it to a list for you.
Some other useful and common arguments are:
-f filename
-v verbose, of course
-z gzip or gunzip
-M multivolume (can span serveral zip disks, etc)
-p preserves permissions
Some things to back up:
/var/spool/mail
/home
/etc
/var/named
/home/httpd/html
/usr/localThe main thing to remember with tar when untarring with tar -xvf or similar is that by default the target will be where you are now, no matter where the source tarball is coming from.
Therefore, if you have a tarball located on /dev/hdc which is mounted on /backup and you are at the root of hda, tar -xzpvf /backup/tarball.tar.gz will untar to hda, not hdc.
telnet - You can install old-fashioned telnet on a machine by installing the telnet-server rpm. Then you've got to emable it in /etc/xinetd.d/telnet and restart the xinetd daemon.
useradd, usermod, userdel - add, change, delete users
useradd -g maingroup -G supplementary groups
groupadd, groupmod, groupdel - add, change, delete groups
users typed alone shows which users are logged in
groups username tells what groups a user belongs to
VESA mode values - To get these different resolutions in the framebuffer, replace the
vga=normal line with vga=769 (for example) in /etc/lilo.conf
Resolution ----------------- Vesa mode values
| 8 bpp | 16 bpp | 24/32 bpp | |
| 640 x 480 | 769 | 785 | 786 |
| 800 x 600 | 771 | 788 | 789 |
| 1024 x 768 | 773 | 791 | 792 |
| 1280 x 1024 | 775 | 794 | 795 |
To begin, type vi plus filename
vi + filename opens file at end of file
vi + /string opens file at first instance of the string
i inserts text before cursor
a inserts text after cursor
I inserts text at the beginning of current line
A inserts text at the end of current line
w tab forward
b tab backward
dw (delete word) deletes the word to the right of the cursor
6dw deletes the next 6 words
dd deletes current line
6dd deletes the next 6 lines
d deletes from the cursor to the end of the current line
d$ deletes from the cursor to the end of the line.
x deletes the character above the cursor
u undoes the last command
U undoes all the changes on a line
CTRL-R undoes the undo's on a line
r next letter you type will replace the letter above the cursor.
cw erases to the end of the word, and then replaces with what you type.
ZZ saves and quits. It's the same as :wq
:w saves but doesn't quit
:w! saves overwriting the present file
:w newfilename saves to a new name
Moving around
$ jumps to the end of the line
0 jumps to the beginning of the line
w jump ahead one word
b jump back one word
B jumps backward one word at a time, ignoring punctuation
z. If you don't like typing at the bottom of the screen, type z. to move everything up half a screen
H moves cursor to the top of the screen
M moves the cursor to the middle of the screen
L moves the cursor to the last line of the screen
e moves to the end of a word.
E moves to the period at the end of the word
( moves to the beginning of the sentence
) moves to the end of the sentence. Also moves you to the beginning of the next line to start typing
{ moves to the top of the current paragraph
} moves to the beginning of the next paragraph
G moves to the end of the file
1G moves to the beginning of the file
/string searches forward for the string
?string searches backward for the string
cw deletes to the end of the word and puts you in insert mode to overwrite
c$ deletes to the end of the line and puts you in insert mode to overwrite
x deletes the letter above the cursor
5x deletes the next 5 letters
r replace the letter above the cursor
s deletes the letter above the cursor and puts you in insert mode to start typing
dw deletes a word. 2dw deletes 2.
dd deletes whole line. 2dd deletes 2.
p pastes text in the buffer after the cursor and on the line below
P pastes before the cursor
xp means "transpose" Type it under 2 letters to transpose them.
yy copies the current line to the clipboard. 4yy does it for 4.
. repeats what you just did, like CTL + y
o opens a blank line below the cursor
O opens a blank line above the cursor
n searches forward for the next instance of a search
N searches backward for the next instance of a search
Cutting and pasting
yy "yanks" the text into an unnamed buffer (6yy yanks 6 lines)
:$ moves the cursor to the end of the file
p pastes the line
"ay) yank from cursor to the end of the paragraph and name "a"
"ayG yank from curor to the end of the page and name "a"
"ap paste buffer "a" on the next line down
VMware -How to install VMware Tools for Linux Guests (from the web site)
After the guest operating system has started, prepare your virtual machine to install VMware Tools.
The remaining steps take place inside the virtual machine.
Note: You do not use an actual CD-ROM to install VMware Tools, nor do you need to download the CD-ROM image or burn a physical CD-ROM of this image file. The VMware Workstation software contains an ISO image that looks like a CD-ROM to your guest operating system. This image contains all the files needed to install VMware Tools in your guest operating system.
Note: Some Linux distributions use different device names or organize the /dev directory differently. If your CD-ROM drive is not /dev/cdrom, modify the following commands to reflect the conventions used by your distribution.
cd /tmp
tar zxf vmware-linux-tools.tar.gz
cd vmware-linux-tools
./install.pl
vmware-toolbox &
Webmin is a graphical Admin tool that works over SSL at https://yourbox.whatever:10000. It does all kinds of things on screen using a web interface. Install it from the RPMs on your disk :
- cd /mnt/cdrom/Mandrake/RPM/webmin...
- rpm -ivh webmin (tab) (enter)
- There is another perl with SSL dependency that you'll have to do first, but I forget what it is. It'll tell you.
wvdial - a modem setup and dialer program
- Put the wvdial rpm in from Red Hat
- Run wvdialconf/etc/wvdial.conf to create the config file
- Edit /etc/wvdial.conf. Uncomment the Phone, Username, and Password lines and put in your info from your ISP.
- Run wvdial on the command line to fire the modem and log in
- Run killall wvdial to disconnect
- You can make .bashrc aliases for the commands above to make them easier to remember.
xcdroast launches the cd burn software
Xinetd - You can restart Xinetd with service xinetd restart.
X mouse pointer - Replace the "X" mouse pointer with an arrow
The various types of cursor available in X are defined in X11/cursorfont.h. You can change it using xsetroot -cursor_name name_of_cursor . For example, I have the following in my .Xclients:
xsetroot -cursor_name left_ptr
This will create the common left-angled pointer. To see other alternatives, type xfd -fn cursor. And of course, do not forget that man xsetroot is your friend.
Y
Yum - Yum is something like apt in that it keeps a database of rpms installed and resolves dependencies for you when you want to install something.
Say you wanted to enable the repository at dungog.net for smeserver. As root, you should run the following (can cut and past if using ssh in Linux shell):
db yum_repositories set dungog repository \
BaseURL http://sme.dungog.net/packages/smeserver/7.0/i386/dungog/ \
EnableGroups yes \
GPGCheck no \
Name 'SME Server 7 - dungog' \
Visible yes \
status disabledThen to enable this change, you need to run:
/sbin/e-smith/expand-template /etc/yum.conf
(Needs a reboot after this.)
This adds dungog to the list of possibilities, but does not download their stuff automatically, as some stuff could clash if you don't know what you're doing.
If you want to install something from dungog using yum, run:
yum --enablerepo=dungog install smeserver-packagename-x.x-x.noarch.rpm
for example and it will fetch everything and let you know when it's ready. Don't forget to
signal-event post-upgrade ; signal event reboot afterward.
/var/cache/yum - This is where yum caches all the rpms it downloads. You can just copy it from one machine to another if you like.
Read man yum here