Linux Quickref
Linux Quickref
/etc/NETWORKING
MOUSETYPE=Microsoft
XEMU3=yes
hostname is set by “/bin/hostname” during
Quick Reference Card (Slackware)
boot and the name is read from these files. network settings, contains
May change manually. network NETWORKING=yes
Jialong He /etc/sysconfig/network
HOSTNAME=hostname.domain.com
[email protected] (Redhat)
http://www.bigfoot.com/~jialong_he
specify name server, DNS domain and
etc/resolv.conf
search order. For Example: NFS File Sharing
User Management search la.asu.edu
nameserver 129.219.17.200 Files
Files
/etc/hosts host name to IP mapping file. /etc/fstab file systems mounted during boot.
/etc/group
/etc/passwd User account information. host name information look up order. /etc/exports NFS server export list.
/etc/shadow Example:
/etc/host.conf /etc/auto.master auto mount master file.
order hosts, bind
/etc/bashrc multi on
/etc/profile Commands
BASH system wide and per user init files. /etc/nsswitch.conf new way to specify information source.
$HOME/.bashrc mount mount a file system or all entries in fstab.
$HOME/.bash_profile /etc/networks
exportfs export file system listed in exports
/etc/csh.cshrc /etc/protocols TCP/IP services and ports mapping.
/etc/csh.login /etc/services showmount –e show file systems exported
$HOME/.cshrc TCSH system wide and per user init files. hostname
/etc/rpc RPC service name to their program numbers
$HOME/.tcshrc mapping.
$HOME/.login
template files for new users. Commands Printer Configuration
/etc/skel
/etc/default default for certain commands. netconfig menu driven Ethernet setup program. Files
/etc/redhat-release Redhat and Slackware version info (Linux pppsetup setup PPP connection (Slackware). /etc/printcap
Printer capabilities data base.
/etc/slackware-version kernel version with “uname –a”) /etc/printcap.local
setup Ethernet during boot, for example
/etc/lpd.conf LPRng configuration file.
Commands /sbin/ifconfig eth0 ${IPADDR} broadcast
permissions control file for the LPRng line
script to create an new user interactively ${BROADCAST} netmask ${NETMASK} /etc/lpd.perms
adduser printer spooler
(slackware) or link to useradd (Redhat). ifconfig
/sbin/route add -net ${NETWORK} netmask /etc/hosts.lpd Access control (BSD lpd).
useradd, userdel, create, delete, modify an new user or update ${NETMASK} eth0
usermod default new user information.. /etc/hosts.equiv trusted hosts.
newusers update and create new users (batch mode). /sbin/route add default gw ${GATEWAY} netmask PRINTER Environment variable of default printer.
0.0.0.0 metric 1 parallel port.
groupadd, groupdel, /dev/lp0
add, delete or modify group. host lookup host name or IP (similar to nslookup).
groupmod
Commands
modify account policy (password length, dnsdomainname show DNS domain name.
expire data etc.) or finger information (full line printer control program, print queue
chage. chfn, chsh arping; arp find out Ethernet address by first arping then arp. lpc, lpq, lprm
name, phone number etc.) change default login maintain
shell. ipchains firewall and NAT (/etc/sysconfig/ipchains on Redhat)
gain root access during boot prompt without iptables firewall and NAT (/etc/sysconfig/iptables on Redhat)
linux init=/bin/sh rw
password, can be used to fix some problems.
Sendmail
ntsysv menu driven SYSV service configuration (Redhat)
mount –w -n –o remount /
chkconfig command line SYSV service configuration (Redhat)
Files
“sendmail.cf” is the configuration file. “sendmail.mc” is
sendmail.cf
a macro file which can be used to generate “sendmail.cf”
Network Configuration sendmail.mc
Redhat files in /etc/sysconfig by: m4 sendmail.mc > sendmail.cf
Files mail aliases, must run “newaliases” after change. use
Configuration Files aliases
:include: to include external list in a file.
/etc/rc.d/rc.inet1
(Slackware) IP address, Network mask, Default gateway keyboard map, e.g.,
keyboard per user aliases, use \yourname to prevent further expand
/etc/sysconfig/nework- are in these files. May edit manually to KEYBOARD=”/usr/lib/kdb/keytables/us.map” .forward
and keeps a copy in mailbox.
scripts/ifcfg-eth0 (Redhat) modify network parameters. mouse Mouse type, e.g.,
access mail access control, FEATURE(access_db) should be set
in sendmail.mc. For example, in /etc/mail/access sysctl configure kernel parameters (Redhat).
cyberpromo.com REJECT
socklist list opened socked.
mydomain.com RELAY
[email protected] DISCARD shutdown [–r|h]
Compile Modules now reboot / halt computer
makemap hash /etc/mail/access < /etc/mail/access
make modules
Building and installing modules.
/etc/mail/relay- make modules_install nmap scan a host for opened ports.
list all host/domain accepted for relaying.
domains
crontab show or edit cron jobs.
Manage Modules
Commands insmod, lsmod, modinfo,
sys-unconfig unconfigure system
newaliases rebuild the data base for the mail aliases file. modprobe, rmmod, Manage loadable modules. chkconfig --list list services started at different run level.
depmod
build access database, e.g, unset TMOUT disable BASH auto-logout feature
makemap
makemap hash access.db<access
unset autologout disable TCSH auto-logout feature
Miscellaneous kudzu probe for new hardware (Redhat).
Useful Configuration Files Files rpm -i INSTALL a package
rpm -e UNINSTALL a package
Files /etc/shells allowed login shells rpm
rpm -q QUERY a package
httpd.conf Apache web server configuration file. /etc/ftpusers user names NOT allowed to use ftp. rpm -U UPDATE a package
lilo.conf LILO boot loder configuration file. /etc/hosts.allow save a man page as a text file and remove control
TCP wrapper access control files. man cmd | col –b
/etc/hosts.deny characters.
syslog.conf System log daemon (syslogd) configuration. >cmd.txt
/etc/sysconfig
ssh_config SSH client and server configuration files. contains system configuration files.
(redhat) Run ntop and listen on web port 3000. View traffic
sshd_config
ntop –w 3000 with browser to http://hostsname:3000
/dev/fd0 floppy drive A
ld.so.conf default dynamic library search path (run
ldconfig). /etc/inittab
system run level control file.
/etc/init.d
mtools.conf mtool configuration file (access DOS file).
Configure Apache 2.0 with SSL
named.conf DNS name server (BIND). Commands
sysctl.conf kernel parameters by sysctl (Redhat). fromdos, todos
mod_ssl
(Slackware) (1) when compile apache, specify –enable-ssl for configure script.
ntp.conf net time server. By default, ssl is not enabled. After compiling, use “httpd –l”
dos2unix, convert text file from/to linux format.
inetd.conf Internet super server. unix2dos to list the modules. “mod_ssl” should be in them.
(Redhat) (2) generate private key with command:
Xinetd.conf, Xinet.d Extended inetd configuration. openssl genrsa -out server.key 1024
directory pwck, grpck verify integrity of password and group files.
proftpd.conf proftpd FTP server. pwconv, (3) generate certificate request
pwunconv, openssl req -new -key server.key -out server.csr
amanda.conf network backup server. convert to and from shadow passwords and groups.
grpconv,
/etc/pine.conf PINE mail client system wide settings. grpuncov (4) generate self-signed certificate
/etc/pine.conf.fixed openssl x509 -req -days 60 -in server.csr -signkey server.key -out
shadowconfig toggle shadow passwords on and off. server.crt
quota,
Rebuild Kernel edquota, (5) modify “ssl.conf” which is included in “httpd.conf”. Note,
quotacheck, specify “httpd –DSSL”, otherwise, commented out <IfDefine SSL>
Configure Kernel Parameters Manage disk quota. in ssl.conf.
quotaon,
quotaoff,
Unpack the tarball in /usr/src directory
repquota,
make config bzip2 -dc linux-2.4.0.tar.bz2 | tar xvf –
make menuconfig lilo -D dos set LILO default OS (default=dos in lilo.conf)
Syslog.conf
make xconfig Configuring the kernel with interactive, menu
ldd find out shared library dependencies. Each line consists of a selector and an action. A selector has two parts:
or X window interface.
facilities and priorites, separated by a period (.),You may precede every
lsof list opened files.
priority with an equation sign (``='') to specify only this single priority
Compile Kernel Source fuser filename show processes that using the file. and not any of the above. You may also (both is valid, too) precede the
make dep Building and installing a new kernel. priority with an exclamation mark (``!'') to ignore all that priorities, either
ifdown
make zImage cp arch/i386/boot/bzImage /boot/vmlinuz bring up/down a network interface (Redhat) exact this one or this and any higher priority.
ifup
Example: security = user ## Change source addresses to 1.2.3.4.
mail.notice /var/log/mail # log to a file In this (default) security mode, samba maintain its own user login database iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to
*.emerg @myhost.mydomain.org # log to remote host which is usually in /etc/samba/smbpasswd. This file is created with 1.2.3.4
command /usr/sbin/smbpasswd. Note, the user login file and command
mangle This table is used for specific types of packet alteration.
Note: separator between first column and second colume (log file name) have the same name but in different directories. Following settings are used:
Build-in chains:
must be TAB, not spaces. encrypt passwords = yes
1. PREROUTING — This chain alters packets
smb passwd file = /etc/samba/smbpasswd
auth, auth-priv, cron, daemon, kern, lpr, mail, mark, received via a network interface before they are
facilities
news, syslog, user, uucp, local0 – local7. routed.
security = domain
priorities debug, info, notice, warning, err, crit, alert, emerg. In this security mode, samba server must join to an NT domain (using net 2. OUTPUT — This chain alters locally-generated
command) and authenticate users by a domain controller. A user must have packets before they are routed via a network
Regular File: interface.
action both valid UNIX and NT account in order to access files.
File with full pathname beginning with “/”.
Terminal and Console: security = server Commands
Specify a tty, same with /dev/console. Use another computer (NT or W2k) to authenticate users. No need to join a
Remote Machine: domain. Need to specify a login server: --flush | -F Flush (delete) rules in the selected chain.
@myhost.mydomain.org password server = mywin.domain.com
--policy | -P Set default policy for a particular chain.
security = share --list | -L List all rules in filter table, use [–t tablename] to
Samba File and Printer Sharing Give each share a password, no user name needed. specify other tables.
A appends a rule to the end of the specified chain.
Introduction
--append | -A
IPtables (Netfilter) -insert | -I Inserts a rule in a chain at a particular point.
Samba provides file and printer sharing with MS Windows computers. It Command Syntax Other commands:
makes UNIX speaks SMB/ICFS file and printer sharing protocol. The (1) --new | -N (2) --delete | -D (3) --replace | -D (4) --zero | -Z
latest version of samba can be downloaded from iptables [-t <table >] <command> <chain > <parameters> (5) –check | -C (6) delete-chain | -X (7) rename-chain | -E
http://www.samba.org. Save and Restore rules
Samba is controlled by a configuration file “smb.conf”. On Redhat Linux, /sbin/iptables-save > /etc/sysconfig/iptables Parameters
one can use “redhat-config-samba” to modify the configuration file. On /sbin/iptables-restore < /etc/sysconfig/iptables
--proto | -p [!] name protocol: by number or name, including tcp,
other systems, SWAT is a web based GUI interface. SWAT is run from
Firewall script sample udp, icmp or all.
“inetd” and listen to port 901. You just need point your browser to
http://tiger.la.asu.edu/iptables_examples.htm source IP address.
http://localhost:901 after starting swat. --source | -s [!] addr/mask
Build-in Table --destination | -d addr/mask destination IP address.
Commands filter This is the default table for handling network packets. Build- --in-interface | -i incoming interface name, e.g. eth0 or ppp0.
in chains are: --out-interface | -o outgoing interface name.
• To test if the syntax of “smb.conf” is correct, use 1. INPUT — This chain applies to packets received
via a network interface. --jump | -j jump to a particular target when matching a
testparm smb.conf 2. OUTPUT — This chain applies to packets sent rule. Standard options: ACCEPT, DROP,
• List shares on a Samba or Windows server out via the same network interface which received QUEUE, RETURN, REJECT. May jump
the packets. to a user defined chain.
smbclient –L machinename -U username
3. FORWARD — This chain applies to packets --fragment | -f match second or further fragments only.
• Connect to a Samba or Windows server and get/put files using received on one network interface and sent out on