NIS Server

Posted: August 7, 2013 in Uncategorized

# rpm -q  ypserv  yp-bind  portmap
#yum install ypserv ypbind portmap
# vim /etc/sysconfig/network
NISDOMAIN=mydomain.com
#nisdomainname  ( if it null set it manually)
#/usr/lib/yp/ypinit -m    ( follow the instructions )
#chkconfig ypserv on
#service ypserv start
#useradd -g users nisuser
#passwd nisuser
#cd /var/yp
#make
#vi /etc/exports (configure nfs to automount the home directory from client machine)
#service nfs start
#chkconfig nfs on

########### In Client machine #############
#authconfig-tui
(configuration of automount part)
login with root in the nis client
#vi /etc/auto.master
It is like this
/autodir /etc/auto.misc
#vi /etc/auto.misc
/autodir/mountdir -rw,soft,intr nfsserver:/nfsshare
#service autofs start
Interview Questions and Answers:-

  1. what is nis ?

Here are the steps to configure the NFS server in this scenario:
1. Edit the /etc/exports file to allow NFS mounts of the /home directory with read/write access.
/home *(rw,sync)
2. Let NFS read the /etc/exports file for the new entry, and make /home available to the network with the exportfs command.
[root@akhan tmp]# exportfs -a
[root@akhan tmp]#
3. Make sure the required nfs, nfslock, and portmap daemons are both running and configured to start after the next reboot.
[root@akhan tmp]# chkconfig nfslock on
[root@akhan tmp]# chkconfig nfs on
[root@akhan tmp]# chkconfig portmap on
[root@akhan tmp]# service portmap start
Starting portmapper: [ OK ]
[root@akhan tmp]# service nfslock start
Starting NFS statd: [ OK ]
[root@akhan tmp]# service nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
[root@akhan tmp]#
After configuring the NIS server, we have to configure its clients, This will be covered next.
Configuring The NFS Client
You also need to configure the NFS clients to mount their /home directories on the NFS server.
These steps archive the /home directory. In a production environment in which the /home directory would be actively used, you’d have to force the users to log off, backup the data, restore it to the NFS server, and then follow the steps below. As this is a lab environment, these prerequisites aren’t necessary.
1. Make sure the required netfs, nfslock, and portmap daemons are running and configured to start after the next reboot.
[root@akhan tmp]# chkconfig nfslock on
[root@akhan tmp]# chkconfig netfs on
[root@akhan tmp]# chkconfig portmap on
[root@akhan tmp]# service portmap start
Starting portmapper: [ OK ]
[root@akhan tmp]# service netfs start
Mounting other filesystems: [ OK ]
[root@akhan tmp]# service nfslock start
Starting NFS statd: [ OK ]
[root@akhan tmp]#
2. Keep a copy of the old /home directory, and create a new directory /home on which you’ll mount the NFS server’s directory.
[root@akhan tmp]# mv /home /home.save
[root@akhan tmp]# mkdir /home
[root@akhan tmp]# ll /


drwxr-xr-x 1 root root 11 Nov 16 20:22 home
drwxr-xr-x 2 root root 4096 Jan 24 2003 home.save


[root@akhan tmp]#
3. Make sure you can mount bigboy’s /home directory on the new /home directory you just created. Unmount it once everything looks correct.
[root@akhan tmp]# mount 192.168.1.100:/home /home/
[root@akhan tmp]# ls /home
ftpinstall nisuser quotauser smallfry www
[root@akhan tmp]# umount /home
[root@akhan tmp]#
4. Start configuring autofs automounting. Edit your /etc/auto.master file to refer to file /etc/auto.home for mounting information whenever the /home directory is accessed. After five minutes, autofs unmounts the directory.
#/etc/auto.master
/home /etc/auto.home –timeout 600
5. Edit file /etc/auto.home to do the NFS mount whenever the /home directory is accessed. If the line is too long to view on your screen, you can add a \ character at the end to continue on the next line.
#/etc/auto.home
* -fstype=nfs,soft,intr,rsize=8192,wsize=8192,nosuid,tcp \
192.168.1.100:/home:&
6. Start autofs and make sure it starts after the next reboot with the chkconfig command.
[root@akhan tmp]# chkconfig autofs on
[root@akhan tmp]# service autofs restart
Stopping automount:[ OK ]
Starting automount:[ OK ]
[root@akhan tmp]#
After doing this, you won’t be able to see the contents of the /home directory on bigboy as user root. This is because by default NFS activates the root squash feature, which disables this user from having privileged access to directories on remote NFS servers. You’ll be able to test this later after NIS is configured.
Note: This automounter feature doesn’t appear to function correctly in my preliminary testing of Fedora Core 3. See Chapter 29, “Remote Disk Access with NFS”, for details.
All newly added Linux users will now be assigned a home directory under the new remote /home directory. This scheme will make the users feel their home directories are local, when in reality they are automatically mounted and accessed over your network.

Advertisements

DHCP Server

Posted: August 7, 2013 in Uncategorized

Overview & Configure the DHCP Server in Redhat Linux 5.

  • Type: SystemV-managed service
  • Package: dhcp
  • Daemon: /usr/sbin/dhcpd
  • Script: /etc/init.d/dhcpd
  • Ports: 67 (bootps), 68 (bootpc)
  • Configuration: /etc/dhcpd.conf, /var/lib/dhcpd/dhcpd.leases
  • Related: dhclient, dhcpv6_client, dhcpv6

Steps of Configuring the Server in Redhat version 5.
# rpm -q dhcpd
# cat /usr/share/doc/dhcp-*/dhcpd.conf.sample > /etc/dhcpd.conf
# service httpd restart

General user:
env – Show environment variables; run a program with altered environment variables
file <filename>– Determine the type of a file
nohup – Run a command with immunity to hangups outputting to non-tty
uptime – Print how long the system has been running
System management:
fuser – Identify processes by files or sockets
logger – Make entries in the system log
newgrp (or sg) – Log in to a new group
pathchk – Check the validity/portability of filenames
shutdown – turn off or reboot a system
shutdown -h now : it will shutdown the computer after shutting down all the services
poweroff -f : it will shutdown computer immediately without looking into the services.
Kernel specific:
date – Print or set the system date and time
dmesg – Print the kernel message ring buffer
ipcrm – Remove a message queue, semaphore set or shared memory ID
ipcs – Provide information on IPC facilities
uname -a : Print assorted system statistics
Processes and task management:
at – Single-time command scheduler
chroot – Change the system root directory for all child processes
cron – Periodic command scheduler
crontab – Crontab file editor
exit – Terminate the current shell process
kill – Send a signal to process, or terminate a process (by PID)
killall – Terminate processes by name (in GNU/Linux)
nice – Alter priorities for processes
pgrep – Find PIDs of processes by name
pkill – Send a signal to process, or terminate a process. Equivalent to Linux killall
ps – Report process status
renice – Alter the priorities of an already running process
sleep – Delay for specified time
time – Time a command
timex – Time process shell execution, measure process data and system activity
top – Produce a dynamic list of all resident processes
wait – Wait for the specified process
watch – Run the specified command repeatedly
Job Control
bg – Resume a job in background
jobs – List active jobs
fg – Resume a job in foreground
User management and support
chsh – Change user shell
finger – Get details about user
id – Print real/effective UIDs/GIDs
last – Show listing of last logged in users
lastlog – Show last log in information for users
locale – Get locale specific information
localedef – Compile locale definitions
logname – Print user’s login name
mesg – Control write access to your terminal
passwd – Change user password
su – Start a new process (defaults to shell) as a different user (defaults to root)
sudo – Execute a command as a different user
users – Show who is logged on (only users’ names)
w – Show logged-in users and their current tasks
whatis – Print command description from whatis database
whereis – Locate the command’s binary and the manual pages associated with it
which – Locate where a command is executed from
who – Show who is logged on (with some details)
whoami – Show the user’s login name
write – Send a message to another user
Terminal configuration
stty – Change and print terminal line settings
tput – Initialize a terminal/query terminfo database
tty – Print filename of terminal connected to standard input
Files and texts
info – The GNU alternative to man
man – The standard unix documentation system
Filesystem Utilities
chattr – Change file attributes on a Linux second extended file system
chgrp – Change the group of a file or directory
chmod – Change the permissions of a file or directory
chown – Change the owner of a file or directory
cd – Change to another directory location
cp – Copy a file or directory to another location
dd – Convert and copy a file in blocks
df – Report disk space
dircmp – Compare contents of files between two directories
du – Calculate used disk space
fdupes – Find or remove duplicate files within a directory
find – Search for files through a directory hierarchy
fsck – Check filesystem
fstat – Identify open files
link – Link one file/directory to another (privileged user only)
ln – Link one file/directory to another
ls – List directory contents
lsattr – List file attributes on a Linux second extended file system
lsof – List open files
mkdir – Make a directory
mkfifo – Make a named pipe
mount – Mount a filesystem
mv – Move or rename a file or directory
pwd – Print the current working directory
rm – Delete a file or directory tree
readlink – Display value of a symbolic link, or display canonical path for a file
rmdir – Delete an empty directory
touch – Create a new file or update its modification time
tree – Print a depth-indented tree of a given directory
unlink – System call to remove a file or directory
Archivers and compression
afio – Compatible superset of cpio with added functionality
ar – Maintain, modify, and extract from static library files (historically also used for archives of other file types)
bzip2 – Compress files by block-sorting
compress – Compress files using the LZW algorithm
cpio – A traditional archiving tool/format
gzip – The gzip file compressor
pack, pcat, unpack – included in old versions of ATT Unix. Uses Huffman coding, obsoleted by compress.
pax – POSIX archive tool that handles multiple formats.
tar – Tape ARchiver, concatenates files
uncompress – Uncompress files compressed with compress.
zcat – Print files to stdout from gzip archives without unpacking them to separate file(s)
Text Processing
awk – A pattern scanning and processing language
banner – Create ascii art version of an input string for printing large banners
cat – Concatenate files to standard output
cksum – Print the CRC checksum and bytecount of a file (see also MD5)
cmp (Unix) – Compare two files byte for byte
comm – Sort two files and compare them line for line
csplit – Split a file into sections determined by context lines
cut – Remove sections from each line of a file or standard input
diff3 – Compare one text file against two other files
diff – Compare two text files line by line
egrep – Extended pattern matching (synonym for “grep -E”)
expand – Convert tabs to spaces
fc – Process the command history list
fgrep – Simplified pattern matching (synonym for “grep -F”)
fold – Wrap each input line to fit within the given width
grep – Print lines matching a pattern
head – Output the first parts of a file
iconv – Convert the encoding of the specified files
join – Join lines of two files on a common field
less – Improved more-like text pager
merge – Three-way merge of files (see also paste)
more – Pager
nkf – Convert Japanese characters
nl – Number the lines of a file
nroff – Fixed-width (non-typesetter) version of the standard Unix typesetting system
od – Dump files in various formats, e.g. octal
paste – Merge lines of files
patch – Change files based on a patch file
rev – Reverse lines of a file
sed – Stream EDitor
sort – Sort lines of text files
split – Split a file into pieces
tac – cat in reverse — display files to standard output in reverse order starting at the end of the file
tail – Output the tail end of files
tee – Read from standard input, write to standard output and files
tr – Translate characters
tsort – Perform a topological sort
unexpand – Convert spaces to tabs
uniq – Remove duplicate lines from a sorted file
uudecode – Decode a binary file that was used for transmission using electronic mail
uuencode – Encode a binary file for transmission using electronic mail
wc – Count words, lines and bytes
Text editors
acme – Bitmapped text editor and integrated development environment ported from the Plan 9 operating system with client-server design, by Rob Pike. This is the successor of sam.
ed – Original line-oriented, regular-expression based Unix text editor
ex – Line-oriented text editor from BSD Unix, originally derived from Unix ed, later augmented by a screen-oriented “visual” mode, creating vi; typically a symbolic link to vi (or vim) causing it to start up in line-editing mode
GNU Emacs – Freely programmable full-screen text editor and general computing environment (using builtin Elisp, a simple dialect of the Lisp programming language)
Joe – A screen-oriented text editor using a Wordstar-style command set
Jove – A screen-oriented text editor using an Emacs-style command set
MicroEMACS – A screen-oriented text editor using an Emacs-style command set
nano – Clone of pico (see below)
NEdit – A Motif based text editor for the X11 windowing system, remniscient of text editors on Mac or Windows systems
nvi – “New” vi, unencumbered (no remaining original Unix code) reimplementation of ex/vi for the 4.4BSD operating system release
pico – PIne’s message COmposition editor (simple, easy to use screen editor)
sam – Bitmapped multifile text editor with client-server design, by Rob Pike
vi – “Visual” (screen-oriented) text editor (originally ex in screen-oriented “visual” mode)
VILE – “Vi Like Emacs”, a vi-like text editor that has been derived from the MicroEMACS text editor
vim – Vi IMproved, portable vi-compatible editor with multiple buffers, screen splitting, syntax highlighting and a lot of other features not found in standard ex/vi
XEmacs – Popular version of emacs that is derived from GNU Emacs
Communication, networking and remote access
Apache – A web server for Unix-like systems
efax – Integrated fax program
ftp, sftp – File transfer protocol, SSH file transfer protocol
HylaFAX – Fax server
minicom – Connect directly to a computer via modem
netcat – Versatile network utility for reading from and writing to network connections
NFS – Network filesystem
OpenVPN – Virtual private (encrypting) networking software
Postfix – Mail transfer agent
rsh, SSH, telnet – Remote login software
Samba – SMB and CIFS client and server for UNIX
Sendmail – Popular email transport software
talk – Utility that allows talking to another logged-in user
uustat – A Basic Networking Utilities (BNU) command that displays status information about several types of BNU operations
uucp – File transfer utility (Unix-to-Unix Copy)
uux – Remote command execution over UUCP
E-mail clients
elm – Screen-oriented mail program that used to be very popular
mail – Original Unix email program
mailx/Mail – Improved version of Unix mail program from BSD Unix
mh – A message handler
Mulberry – Powerful graphical IMAP-centric e-mail client (recently released as open source)
Mutt – Screen-oriented mail program
nmh – A new message handler
Opera – Web browser and e-mail client (proprietary)
Pine – Screen-oriented mail and news program, originally derived from elm
procmail – Automatic mail sorting
Mozilla Thunderbird – Extensible e-mail client
Network system services
fingerd – A daemon for finger – a program used to return a human-readable status report on either the system at the moment or a particular person in depth
inetd – A daemon on many Unix systems that manages Internet services
xinetd – Replacement for inetd
{ For edit the section, register yourself } Network Utilities
authbind – Used to authorize non-root users to use port numbers below 1024
dhclient – A DHCP client
dhcpd – The DHCP daemon
dhcpcd – A DHCP client-daemon
ifconfig – A tool used to configure a network interface for TCP/IP
iwconfig – Similar to ifconfig, but is dedicated to wireless networking interfaces
ping – A network tool that tests of whether a particular host is up and reachable on the network
pppd – Point-to-Point Protocol daemon
tcpd – Secures programs launched from inetd
{ For edit the section, register yourself } Network monitoring and security
Ethereal and tethereal – A packet sniffer deprecated in favor of a fork called Wireshark
ettercap – A tool for network protocol analysis
John the Ripper – Password-cracking software
Nessus – A comprehensive open-source network vulnerability scanning program
Netstat – Displays a list of the active network connections the computer
Nmap – Free port scanning software
SAINT – System Administrator’s Integrated Network Tool – Network Vulnerability Scanner.
SATAN – the Security Administrator Tool for Analyzing Networks – A testing and reporting tool that collects information about networked hosts
Snoop – Solaris packet sniffer
Snort – An open source network intrusion detection system
tcpdump – A computer network debugging tool that intercepts and displays TCP/IP packets being transmitted or received
Wireshark – A protocol analyzer with GUI frontend and various sorting and filtering options that was forked from Ethereal by its original author.
Script Interpreters
printf – Format and print data
strings – Print strings of printable characters found in a file
test – Test an expression
times – Prints information about the current shell execution’s time
true – Return a value that evaluates as True
unset – Unset a shell variable
xargs – Build and execute command lines from standard input
expr – Evaluate expressions
User interfaces
X11 – Graphical user interface (GUI)
o          startx and xinit
o          xterm
Desktops/Graphical User Interfaces
4dwm – Variant of the Motif Window Manager found on Silicon Graphics’ IRIX operating system
Blackbox and its variants (including Fluxbox and Waimea)
CDE – Common Desktop Environment, most commonly found on proprietary UNIX systems
dfm – Desktop File Manager resembling OS/2 and designed to work with IceWM
EDE – Small desktop environment that is meant to be simple and fast
Enlightenment – an open source window manager for the X Window System
FVWM – Virtual window manager
FVWM95 – Window manager designed to behave like Windows 95
FVWM-Crystal – Flashy window manager
GNOME – GNU Network Object Model Environment
IceWM – ICE Window Manager
Ion (window manager) – Tiling and tabbing window manager for the X Window System, designed for use without a mouse
JWM – Joe’s Window Manager
KDE – K Desktop Environment
MWM – Motif Window Manager
Quartz Compositor – Apple’s GUI interface for the Darwin BSD based operating system Mac OS X
Window Maker – Window manager designed to emulate NeXT’s GUI
WMI – Window Manager Improved
XFce – A desktop environment for Unix and other Unix-like platforms
Secutiry
ClamAV – open-source virus scanner
Enigmail – Graphical interface to gpg for Mozilla Application Suite and Mozilla Thunderbird
gpg – GNU Privacy Guard, a complete and free replacement for PGP (to do file and email encryption and signature).
mcrypt – Replacement for the legacy crypt program; can also make OpenPGP-compatible files.
openssl – Secure Sockets Layer and general crypto library.
pinepgp – Filters that enable pine to use signed/encrypted email.
Package management software
apt – Front-end for dpkg or rpm
debconf – Debian package configuration management system
dpkg – The Debian package manager
drakconf – Front-end configuration utility for Mandriva Linux
GNU Stow – Link applications from specific directories into a common directory
emerge – A frontend to portage
pacman – A package manager used primarily by Arch Linux
portage – The Gentoo Linux package manager
rpm – Originally the package manager for Red Hat Linux, now used by several distributions including Mandriva Linux
Synaptic – GTK+ frontend for the apt package manager. Primarily used by Ubuntu Linux, Debian Sarge, and other Debian-based systems; but usable on any system using apt
urpmi – Front-end to rpm, used by Mandriva Linux
YaST – System management utility mainly used by SuSE
yum – Front-end for rpm, used by Fedora
OS X/Darwin specific programs
defaults – Access the Mac OS X user defaults system
fink – The Fink package manager
open – Opens argument(s) in the GUI as if the user had double clicked
osacompile – Compile AppleScripts and other OSA language scripts
osalang – Information about installed OSA languages
osascript – Execute AppleScripts and other OSA language scripts
say – Convert text to audible speech
Desktop Publishing
LaTeX – Popular TeX macro package for higher-level typesetting
lp – Print a file (on a line printer)
Passepartout – Desktop publishing program
pr – Convert text files for printing
Scribus – Desktop publishing program
TeX – Macro-based typesetting system
troff – The original and standard Unix typesetting system
Desktop utilities
bc – An arbitrary precision calculator language with syntax similar to the C programming language
cal – Display a calendar
dc – Reverse-Polish desk calculator which supports unlimited precision arithmetic
fortune – Fortune cookie program that prints a random quote

FTP Server

Posted: August 7, 2013 in Uncategorized
  • FTP
  • Package: vsftpd
  • Daemon: /usr/sbin/vsftpd
  • Script: /etc/init.d/vsftpd
  • Ports: 21 (ftp), 20 (ftp-data)
  • Configuration: /etc/vsftpd/vsftpd.conf  
  • /etc/vsftpd.ftpusers 
  • /etc/pam.d/vsftpd
  • Log: /var/log/xferlog
  • Related: tcp_wrappers, ip_conntrack_ftp, ip_nat_ftp
  • SElinux help: man 8 ftpd_selinux

Apache Server

Posted: August 7, 2013 in Uncategorized
  • APACHE
  • Packages: httpd, httpd-devel, httpd-manual
  • Daemon: /usr/sbin/httpd
  • Script: /etc/init.d/httpd
  • Ports: 80(http), 443(https)
  • Configuration: /etc/httpd/*, /var/www/*
  • · Related: system-config-httpd, mod_ssl

Varify or Install packages with:
# rpm -q httpd
# rpm -ivh httpd-*
# yum install httpd
Use the chkconfig command to configure Apache to start at boot:

# chkconfig httpd on

Use the httpd<code> init script in the <code>/etc/init.d directory to start,stop, and restart Apache after booting:

# /etc/init.d/httpd start
# /etc/init.d/httpd stop
# /etc/init.d/httpd restart

You can test whether the Apache process is running with

# pgrep httpd
# service httpd status

NFS Server

Posted: August 7, 2013 in Uncategorized
  • NFS
  • Package: nfs-utils
  • Daemons: rpc.nfsd, rpc.lockd, rpciod, rpc.mountd, rpc.rquotad, rpc.statd
  • Scripts: /etc/init.d/nfs, /etc/init.d/nfslock
  • Ports: 2049(nfsd), Others assigned by portmap (111)
  • Configuration: /etc/exports

Related: portmap (mandatory), tcp_wrappers
configure NFS to export any directory:-
vim /etc/exports
/home *(rw,sync)
save and exit.
#showmount -e localhost

Sendmail Server

Posted: August 7, 2013 in Uncategorized
  • SENDMAIL
  • Packages: sendmail, sendmail-cf, sendmail-doc
  • Daemon: /usr/sbin/sendmail
  • Script: /etc/init.d/sendmail
  • Port: 25 (smtp)
  • Configuration: /etc/mail/sendmail.mc, /etc/aliases, and others
  • Related: procmail (MDA), spamassassin, tcp_wrappers, sendmail-doc

configuration of sendmail in redhat linux.
check for required package installation.
# rpm -q sendmail  sendmail-cf  sendmail-doc m4
use package updater ( yum in redhat linux ) for installtion of the required packages.
#yum install sendmail sendmail-cf sendmail-doc m4
Take the backup of your senmail.mc file.
#cp /etc/mail/sendmail.mc /etc/mail/sendmail.mc.back

Now edit sendmail.mc file in vi editor:-
comment line no 116 i.e. DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA’)dnl
add dnl # before this line
Now give the localhost as your hostname and localdomain as your domain name of the organisation.
Save and exit the file.
Now create cf file using this mc file, since handediting of cf file is not recommended.
#m4 sendmail.mc > sendmail.cf
# service sendmail restart
#chkconfig sendmail on
#rpm -q dovecot
#service dovecot restart
#chkconfig dovecot on