Basic Commands
Basic Commands
Red Hat Certified Engineer (RHCE) began in 1999 and has been earned by over 20,000 Linux experts.
Independent surveys have ranked the RHCE program as #1 overall for all of IT.*
* CertCities.com named RHCE the #1 “Hot Cert” in all of IT for 2006
Linux History
1 By the beginning of the 90s home PCs were finally powerful enough to run a full blown UNIX.
Linus Torvalds, a young man studying computer science at the university of Helsinki, thought it
would be a good idea to have some sort of freely available academic version of UNIX, and
promptly started to code.
2 He started to ask questions, looking for answers and solutions that would help him get UNIX on
his PC. Below is one of his first posts in comp.os.minix, dating from 1991:
Structure of LINIX
1 The kernel is the core of the system controlling hardware and performing lowlevel functions.
2 The shell is the command interpreter (user interface).
3 Two hundred + utility programs provide functions like file copy, text edit, software compilation
and so on.
The kernel
The kernel is the "core" of any computer system: it is the "software" which allows users
to share computer resources.
1 The kernel interacts directly with system hardware, implements the file system,
manages memory, enforces security, performs I/o. If the system is muti-user, the kernel
provides the system timesharing capability.
Shell types
1 sh or Bourne Shell
2 bash or Bourne Again shell
3 csh or C shell:
4 tcsh or Turbo C shell
5 ksh or the Korn shell
ls:
#ls - to list files and folders
#ls –l - to list files and folders, with these components
#ls –a - List all files and folder (Including hidden files)
#ls –la - List files and folders, with these components (Including hidden files)
#ls –il - List all files and filders, with these components and inodes
#ll - same as ls –l
#ls –l <file> - List particular file components
#ls –ld <folder> - List particular folder components
#ls –F - Listing & differentiate files and folder
#ls –lZ - to list a file components of SELinux
#ls –si - List only files & folders inodes
#ls –g - don’t list on user owner for files & folders
#ls /usr/bin | sort –r | more - list all files of reverse the result of alphabetical from /usr/bin
#lsof - to check what files are open your system
#less <file1> - list a file contents (cursor movements up and down)
#more <file> - list a file contents (cursor movements down only)
#ls > filelist - standard ls output redirect to “filelist”
cat:
#cat > file1 - Create new file1
#cat >> file1 - Edit an existing file1
#cat file - to list a file contents
#zcat file.gz - to list a Zip file contents
#cat –A file1 - to check end of lines for files whether space or not
#cat –b file1 - to check number of lines for a file
#cat /dev/null > /root/file1 - file1 contents are come into zero
#cat > file1 file2 - copy contents from file2 to file1
touch:
#touch <file> - create an emty file
#touch <file1> <file2>…. - create more than one file at a time
mkdir:
#mkdir <dir> - create a directory
#mkdir –p <dir/dir1> - create a directory in directory at a time
date:
#date - List system date & time
#date MMddhhmmyyyy- to set on system date & time
Eg: #date 102512502008
#date –u 102512502008 - to set Universal time
#date “+%m” - to list number of current month
#date “+%d” - to list number of current date
#date “+%y” - to list number of current year
#date “+%D” - to list number of current date, month, year
cal:
#cal - to list current month calendar
#cal 2000 | more - to list 2000 year calendar
#cal 5 2000 - to list a particular month and year calendar
wc:
#wc <file1> - to list counts of words, lines, characters for a file
#wc –l <file1> - to list number of lines for a file
#wc –c <file1> - to list number of character for a file
#wc –w <file1>- to list number of words for a file
bc:
#bc - An arbitrary precision calculator language
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
6*5
30
10+15
25
cmp:
#cmp <file1> <file2> - Compare two files
#cmp –l <file1> <file2> - Print the byte number (decimal) and the differing byte values
(octal) for each difference.
diff:
#diff <file1> <file2> - find differences between two files
#diff –c <file1> <file2> - differences Use the context output format between two files
#diff3 <file1> <file2> <file3> - find differences between three files
#diff –l file1 file2 >> /root/print - file differences are store in /root/print
ispell:
#ispell /etc/sysconfig/network - spell check to specified file contents
NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=server1.example.com
NISDOMAIN=RHCE
-----------------------------------------------------------
1) IV 3) IRV
2) IPA
-----------------------------------------------------------
i) Ignore I) Ignore all
r) Replace R) Replace all
a) Add l) Add Lower
b) Abort x) Exit
-----------------------------------------------------------
?(here enter the above option)
head:
#head file1 - output the first part of a file
#head –c 10 <file1> - output the first 10 character of a file
#head –n 3 <file1> - output the first 3 lines of a file
tail:
#tail /etc/passwd - output the last part of a file
#tail –n5 /etc/passwd - output the last 5 lines of a file
pwd
#pwd - Present working directory
echo:
#echo - display a line of text
#echo –-version - output version information and exit
#echo $PATH - Path of the user(mostly user command are stored in the below path)
#echo $(date) - to list out date & time
#echo $HOME - to list out user home directory
#echo $OSTYPE - list OS type (eg. Linux-gnu)
#echo “I Finished my projects on $(date)” >> /root/project
1 line of text are stored in the file of “project”
Helping Commands
#man <command> - format and display the command on-line manual pages
#info <command> - read Info a command
#<command> --help - List a Command help
#man ls >> /root/list - “ls” command man page store in /root/list
cp:
#cp file1 file2 - to copy a file
#cp file1 /root/file2 - to copy a file in to a folder
#cp –r dir1 dir2 - to copy a directory
#scp file1 root@172.24.0.1:/root/file2 - copy a file from one host to another host
#scp –r dir1 root@172.24.0.1:/root/ - copy a directory from one host to another host
mv:
#mv file1 file2 - rename a file from file1 in to file2
#mv file1 /root - move a file1 in to a directory
rm:
#rm file1 - remove a file
#rm –f file - remove a file without asking any confirmation
#rm –r dir1 - remove a directory
#rm –rf dir1 - remove a directory without asking any confirmation
tar:
#tar –cvf <file1.tar> <file1> - create a tar file
#tar –xvf file1.tar - to extract a tar file
#tar –xvzf file1.rar.gz - to extract zipped tar file
x-extract; v-verbose; z-zip; f-file;
cd:
#cd /dir1/dir2 - Change the current directory to dir
#cd .. - come from dir2 to dir1
#cd - come back to home directory
gpg:
#gpg -c file1 - to create an encryption file
gpg: directory `/root/.gnupg' created
gpg: new configuration file `/root/.gnupg/gpg.conf' created
gpg: WARNING: options in `/root/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/root/.gnupg/pubring.gpg' created
Enter passphrase:
Repeat passphrase:(change file1 to file1.gpg)
#gpg file1.gpg - to decrypt on encrypted file
gpg: keyring `/root/.gnupg/secring.gpg' created
gpg: CAST5 encrypted data
Enter passphrase:
find:
#find / -name <file> - search for file in a directory hierarchy
#find /etc –name <file> - search for file in a /etc directory
#find /etc > /tmp/myfile & - listed etc folder contents are store in /tmp/myfile
#locate <filename> - find files by name
File compress
#gzip file1 - to create a zip file(file1 to file1.gz)
#gunzip file1.gz - to extract a zipped file
#bzip2 - to create a zip file(file1 to file1.bz2)
#bunzip2 file1.bz2 - to extract a zipped file
#zip <file1.z> <file1> - to create zip or compress (archive) files
#unzip file1.z - extract compressed files in a ZIP archive
shutdown:
#shutdown - system shutdown
#shutdown -h +10 - system shutdown after 10 min
#shutdown -r now - system shutdown now
#shutdown -h +5 "System needs a rest" - shutdown system after 5 min
reboot:
#reboot - system reboot
#reboot –f - force reboot
#halt - system halt
#poweroff - system power off
#lsmod - lists the modules that are currently loaded into the kernel
#modinfo <module> - list out a particular module information
#rmmod <module> - removes a module from the kernel
#modprobe <module> - automatically load modules to kernel
Search
/pattern <RETURN> forward for a pattern
?pattern <RETURN> backward for a pattern
n repeat previous search
N repeat previous search in reverse direction
Undelete
p insert after cursor
P insert before cursor
Goto line
:linenumber
nG Goto line n
:7 Goto line 7
Undo
u the latest change
U all changes on a line
uname:
#uname –a - print all system information
#uname –r - print the kernel release versions
#uname –s - print the kernel name
#uname –n - print the network node hostname
#uname –m - print the machine hardware name
#uname –p - print the processor type or "unknown"
chattr:
#chattr +i or a <file> - to change attribute or read only a file
#lsattr <file> - we can check a file whether attribute or not
#chattr –i or a <file> - release from attribute
cron:
#crontab –e
#crontab –eu <user>
minute hour day-month month day(s)-week task
0 2 * * 1-5 tar cf /home/ backp /home/projects
0 2 * * Mon-Fri tar cf /home/backp /home/projects
0 2 * * 0,3,5 tar cf /home/backp /home/projects
12 12 * * * /bin/cp /root/hai /mnt/raj
#chkconfig crond on
#service crond restart
The following runlevels are defined by default under Red Hat Enterprise Linux:
1 . 0 . Halt (or) Shutdown
2 . 1 . Single-user text mode
3 . 2 . multiuser mode without NFS
4 . 3 . Full multi-user text mode
5 . 4 . Not used
6 . 5 . Full multi-user graphical mode (with an X-based login screen)
7 . 6 . Reboot
init or telinit:
switching to one runlevel to another runlevel using the following commands:
#init 0 or #telinit 0 - system halt or power off
#init 1 or #telinit 1 - single user mode
#init 2 or #telinit 2 - multiuser mode
#init 3 or #telinit 3 - full multiuser mode
#init 5 or #telinit 5 - GUI or graphical mode
#init 6 or #telinit 6 - system reboot
#init s or #telinit s - single user mode
#init S or #telinit S - single user mode
System Monitoring
System Processes:
#ps - list out current terminal process
#ps –au - List all system terminal process
#ps –ef - list all system process
#ps aux | less
#pidof <process> - list out system process id
#ps aux | grep emacs - list out system process information
#ps aux | egrep cron - same as grep
#ps aux | fgrep cron - same as grep
#pgrep sendmail - list out system process information
#pstree - display the tree of process
#ps –U root –u root –N - see every process except running as root
#ps –u <user> - see process run by a user
#top - displays currently running processes and important information about
them including their memory and CPU usage.
#gnome-system-monitor - displays GUI mode system running process
#dmesg - list out disk boot message
#dmesg –c - clear all the disk boot message
kill:
#kill <Process ID> - terminate a process
#killall <Process name> - kill process by name
Memory Usage:
#free - displays the total amount of physical memory and swap space
#free –m - shows the same information in megabytes
#uptime - Prints the system uptime
Data backup
#dump -f /mnt/backup /root/file1 - file1 backup are stored in /mnt/backup
#restore –ivf /mnt/backup - restore backup file
restore > ls
restore > add root
Make node ./root
restore > ls
2 ./ 2 ../ 1438977 *root/
restore > extract
Extract requested files
You have not read any volumes yet.
Unless you know which volume your file(s) are on you should start
with the last volume and work towards the first.
Specify next volume # (none if no more volumes): 1
extract file ./root/anaconda-ks.cfg
Add links
Set directory mode, owner, and times.
set owner/mode for '.'? [yn] n
restore > quit
Linux filesystem
File system:
The file system provides the structure in which information is stored on the Computer.
Information is stored in files, primarily on hard disks inside the computer.
File System Hierarchy Standard (FHS) for Linux:
Directory Description
/ - root directory of the entire file system hierarchy.
/bin - Essential command binaries that need to be available in single user mode
/boot - Boot loader files
/dev - Essential devices
/etc - Host-specific system-wide configuration files
/home - Users' home directories - containing saved files, personal settings etc
/lib - Libraries essential for the binaries in /bin/ and /sbin
/media - Mount points for removable media such as CD-ROMs
/mnt - Temporarily mounted filesystem
/opt - Optional application software packages
/sbin - Essential system command binaries
/root - Home directory for the root user
/proc - Virtual filesystem documenting kernel and process status as text files
/srv - Site-specific data which is served by the system
/tmp - Temporary files
/usr - Secondary hierarchy for user data, contains the majority of user utilities and
Applications
/var - Variable files, such as logs, spool files, and temporary e-mail files
File Systems:
#df - reports the system's disk space usage
#df –h - human-readable format for system's disk space usage
#du –hs /etc/passwd - displays the estimated amount of space being used by files in a
Directory
#du –hcs * - list out all file size in a directory or disk,
Hardware:
#yum install hwbrowser* - install system hardware browser tool
#hwbrowser - displays GUI mode system hardware browser
#lspci - to list all PCI devices
#lspci –v - verbose information all PCI devices
#cd /proc - The contents of the proc directory can also be used to gather
#ls - more detailed system information
#vim /proc/filesystems - displays a list of the file system types currently supported by
the kernel
#vim /proc/devices - number and name of the device (Character & Block devices)
#vim /proc/cpuinfo - identifies the type of processor used by your system
#vim /proc/iomem - current map of the system's memory for each physical device
#vim /proc/ioports - list of currently registered port used for input or output
communication with a device.
#vim /proc/meminfo - reports valuable information about the systems RAM usage.
#vim /proc/modules - displays a list of all modules loaded into the kernel
#vim /proc/partitions - contains partition block allocation information
#vim /proc/mounts - list of all mounts in use by the system
#vim /proc/uptime - how long the system has been on since its last restart
#vim /proc/version - list the version of the Red Hat Linux kernel
#vim /proc/net/arp - list the hardware address to an IP address on a system
#/etc/sysconfig/authconfig
The /etc/sysconfig/authconfig file sets the following authorization to be used on the host..
1 MD5 authentication
2 Kerberos authentication
3 LDAP authentication
.
# /etc/sysconfig/autofs
The /etc/sysconfig/autofs file defines custom options for the automatic mounting of devices.
#vim /etc/sysconfig/clock
The /etc/sysconfig/clock file controls the interpretation of values read from the system hardware clock.
#vim /etc/sysconfig/desktop
The /etc/sysconfig/desktop file specifies the desktop for new users and the display manager to
run when entering runlevel 5.
#vim /etc/sysconfig/i18n
The /etc/sysconfig/i18n file sets the default language, any supported languages, and the default
system font.
#vim /etc/sysconfig/init
The /etc/sysconfig/init file controls how the system appears and functions during the boot
process.
1 Extension
2 Path
3 Permission
4 Inode
File Types
Compressed and Archived Files:
1 .bz2. - a file compressed with bzip2
2 .gz. - a file compressed with gzip
3 .tar. - a file archived with tar (short for tape archive),
4 .tbz or .tar.bz. - a tarred and bzipped file
5 .tgz or .tar.gz. - a tarred and gzipped file
File Formats:
1 .au - audio file
2 .gif - GIF image file (short for Graphics Interchange Format)
3 .html or .htm - HTML file (short for Hyper Text Markup Language)
4 .jpg - JPEG image fle (short for Joint Photographic Experts Group)
5 .pdf - electronic image of a document; (PDF-Portable Document Format)
6 .png - PNG image file (short for Portable Network Graphic)
7 .ps - PostScript file; formatted for printing
8 .txt - plain ASCII text file
9 .wav - audio file
10 .xpm - image file (short for X Pixelmap)
System Files:
1 .conf a configuration file; sometimes use the .cfg extension, as well
2 .lock a lock file; determines whether a program or device is in use
3 .rpm a Red Hat Package Manager file used to install software
File types
1 d = directory
2 l = symbolic link
3 s = socket
4 p = named pipe
5 - = regular file
6 c = character (unbuffered) device file
7 b = block (buffered) device file
#ls –l <file1>
Permission field Links Owner Group Bytes modification
| | | | | | |
drwxrwxrwx 4 root root 122 Dec 12 18:02 file1
File Permissions:
- rw- r-- r-- - The permissions are shown on the left-hand side of the file
| | | |
T U G O T – types; U-user; G-group; O-others;
Permissions vs Numeric
r+w+x -7 w+x -3
r+w -6 w -2
r+x -5 x -1
r -4
umask
#umask 555 - masking read and write permission for user, group and others
#umask 777 - masking all permission for user,group and others
#touch file1
#ls –l file1
---------- 1 root root 0 May 16 15:44 file1
#chown stg:sysadmin file1 - to change user and group owner for a file
#ls –l file1
-rw-r--r-- 1 stg sysadmin 0 May 16 16:19 file1
#chgrp sysuser file - to change group owner of the file
note:
Whenever we will create a user automatically one group will be create that group name is
same as user name. This group is the primary group of that user
User rename:
#usermod –l <new name> <old name> - rename a user
Password lock:
#passwd -l <user1> - password lock for a user1
#grep user1 /etc/shadow - to check whether password lock or not for user1
user1:!!$1$hoyAUH3r$prcM0AUK0CimVsImXoR4h0:13983:0:99999:7:::
!! - that symbol define is whether password lock or not
#passwd -u <user1> - password unlock for a user1
Password Aging
#chage –l <user1> - list out password status for user1
Last password change : Apr 12, 2008
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires :7
Group configuration:
#groupadd <group> - create new group
#groupadd –g 505 <group> - setting group ID for new group
#groupmod –g 512 <group1> - setting group ID for existing group
#groupmod –n <new name> <old name> - group rename for a group
#gpasswd <group> - setting passwd for a group
#grep group1 /etc/gshadow
group1:ExNL83L8h2AcY::
#man 5 group. - The file containing group information for the system.
#man 5 passwd. - The file containing user information for the system.
#man 5 shadow . - containing passwd and account expiration information for a system
User Information:
#finger - displays information about the system login users
#finger <user1> - displays information about the system users
Login: stg Name: (null)
Directory: /home/stg Shell: /bin/bash
Never logged in.
No mail.
No Plan.
#whoami - Print the user name with the current effective user ID
#who am i - show who is logged on
#id - Print the user name with the current user ID & Group ID
user1 ALL=ALL !DRIVERS -give to all privilege except DRIVER command alias for a user
%group1 ALL=ALL !DRIVERS - give to all privilege except DRIVER command alias for group
Floppy drive:
First floppy (Microsoft A: drive) = /dev/fd0
Second floppy (Microsoft B: drive) = /dev/fd1
Hard drive:
IDE1 hard drive/CD-DVD master IDE drive = /dev/hda
(primary IDE1 connector) slave IDE drive = /dev/hdb
IDE2 hard drive/CD-DVD master IDE drive = /dev/hdc
(secondary IDE2 connector) slave IDE drive = /dev/hdd
Create a partition:
#fdisk /dev/hda - create a partition for first primary IDE
#fdisk /dev/sdc - create a partition for the third SCSI disk
#fdisk /dev/eda - create a partition for the first PS/2 ESDI drive
#fdisk /dev/rd/c0d0 or fdisk /dev/ida/c0d0 - create a partition for RAID devices
Delete a partition:
Command (m for help): d
Partition number (1-13): 13
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
Mount a partition:
#mkdir /data - create a directory for mount
#mount /dev/hda13 /data - mount a partition under /data
#vim /etc/fstab - to enter the below entry in file for permanent mount
/dev/hda13 /data ext3 defaults 00
:wq!
#df –h - displays the amount of disk space available on the file system
Filesystem Size Used Avail Use% Mounted on
/dev/hdc7 9.5G 5.0G 4.1G 56% /
/dev/hdc6 99M 11M 83M 12% /boot
tmpfs 470M 0 470M 0% /dev/shm
/dev/hda13 476M 0 476M 0% /data
#cat /etc/mtab - List out all partition & its mount information
#cat /proc/mounts
#mkswap /dev/sda3
Setting up swapspace version 1, size = 756719 kB
#swapon /dev/sda3
IP NETWORKING
#ifconfig - check IP address / netmask /broadcast/MAC address Etc..
#ifconfig eth0 - to check specific Ethernet Interface properties
#ifconfig eth0 172.24.0.10 netmask 255.255.0.0 broadcast 172.24.255.255
- setting IP Address for a specific Ethernet interface
#ifconfig eth0 arp - Enable use of the ARP protocol on this interface
#ifconfig eth0 –arp - Disable use of the ARP protocol on this interface
#ifconfig eth0 up - Setting Ethernet interface to be up
#ifconfig eth0 down - Setting Ethernet interface to be down
#chkconfig network on
#service network restart
#ifconfig
eth0 Link encap:Ethernet HWaddr 00:11:11:BB:04:32
inet addr:172.24.254.254 Bcast:172.24.255.255 Mask:255.255.0.0
inet6 addr: fe80::211:11ff:febb:432/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10601566 errors:0 dropped:0 overruns:0 frame:0
TX packets:10611716 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:678410632 (646.9 MiB) TX bytes:577259667 (550.5 MiB)
route:
#route - show the IP routing table
#route add –net 172.24.0.0 netmask 255.255.0.0 dev eth0
- add a routing for a network
#route add –host 172.24.0.2 dev eth0 - add a routing table for a host
#route del –host 172.24.0.2 - delete a routing table for a host
Print Commands
#lpr <file1> - The basic print command. lpr filename prints that file.
#lpr -l - lists print job numbers
#lpq - Query the print queue for status.
#lprm - Remove a specific job, from the printer queue
l
First cylinder (4765-4869, default 4765):
Using default value 4765
Last cylinder or +size or +sizeM or +sizeK (4765-4869, default 4869): +500M
#vim /etc/fstab - enter the mount information of LVM for permanent mount
/dev/myvol/sysvol /data ext3 defaults 00
:wq!
#mount –a
#vim /etc/fstab
/dev/hdc6 /data ext3 defaults,usrquota 0 0
:wq!
#mount –a
#mount –o remount, usrquota /data
#quotacheck /data
#ls /data - to check it whether “aquota.user” created or not
aquota.user lost+found
Type of RAID:
1 Software RAID (" Operating system based ")
2 Hardware RAID (“Physical hardware based”)
RAID 0:
#fdisk /dev/hda- create two partition for Raid
Command (m for help): n
First cylinder (4765-4869, default 4765):
Last cylinder or +size or +sizeM or +sizeK (4765-4869, default 4869): +500M
Command (m for help): n
First cylinder (4765-4869, default 4765):
Last cylinder or +size or +sizeM or +sizeK (4765-4869, default 4869): +500M
Command (m for help): w
#vim /etc/fstab
/dev/md0 /backupext3 defaults 00
:wq!
#mount –a
#mdadm –-manage /dev/md0 –-add /dev/hda8 (or) - to add again raid device
#mdadm –v /dev/md0 -a /dev/hdc8
NETFILTER
Netfilter tables and Chains:
Filterpoint Table
filter nat mangle
Input * - *
Forward * - *
Output * * *
Prerouting - * *
Postrouting - * *
Nat – Network Address Translation
Mangle – This table is rarely used
Filter – Main packets filter
Prerouting - This filtering points deal with packets first upon arrival (nat).
Forward - Handles packets being routed through the local system (filter).
Input - Handles packets destined for the local system, after routing decision (filter).
Output - Handles packets after they have left their sending process, and prior to
postrouting (nat and filter).
Postrouting - Handles packets immediately prior to leaving the system (nat).
#iptables –L
#iptables –F
#chkconfig iptables on
#service iptables save
#service iptables restart
#cat /etc/sysconfig/iptables
#iptables –D input 1
TCP Wrappers:
#
SSH RSA keys generation with authentication for remote login users:
(A user should login without password)
User1: raaj & User2:ganesh
In User1 (raaj)
[raaj@localhost ~]$ssh ganesh@172.24.254.254
login as: ganesh
ganesh@172.24.254.254's password:
[ganesh@localhost ~]$
In User2 (ganesh)
[ganesh@localhost ~]$ssh raaj@172.24.254.254
login as: raaj
raaj@172.24.254.254's password:
[raaj@localhost ~]$exit
[ganesh@localhost ~]$exit
[raaj@localhost ~]$
Note: all users except root will be able to use rexec, rsh, and rlogin.
If you wanted to enable root login using rexec, rsh, and rlogin, add the following lines to /etc/securetty
#vim /etc/securetty - This will allow up to 10 telnet sessions to the server as root
rexec
rsh
rlogin
pts/0
pts/1
#telnet 172.20.250.250
login:
password:
#rsh 172.20.250.250 -l raaj - Remote Login user raaj using rsh
#rlogin 172.20.250.250 -l raaj - Remote Login user raaj using rlogin
# rexec 172.20.250.250 -l raaj hostname - execute a command from remote user host
Password:
system100.example.com
Troubleshooting:
Login Error
1.Password change
#passwd root
3. Password lock
#passwd –l root
#grep root /etc/shadow
#passwd –u root
4.Files check
#vim /etc/passwd
#grep root /etc/password
#vim /etc/shadow
#grep root /etc/shadow
5.Files attribute
#lsattr /etc/passwd
----ia------- /etc/passwd
#lsattr /etc/shadow
----ia------- /etc/shadow
#chattr –ia /etc/passwd
#chattr –ia /etc/shadow
9.Account expired
#usermod –e 2005-03-05 <user1> - Account expires : March 05, 2005
#chage –l root
#chage –E never root
10.Check and Remove these below words from user environmental variable file scripts
exit, logout, sleep
#vim /etc/bashrc
#vim /etc/profile
#vim /etc/profile.d/*.sh
#vim /root/.bashrc
#vim /root/.bash_profile
#vim /etc/pam.d/password
#%PAM-1.0
auth include system-auth
account include system-auth
password include system-auth
# vim /etc/passwd
nisuser1:x:501:501::/rhome/nisuser1:/bin/bash \\ make it
#vim /var/yp/Makefile
Line No: 109 all: passwd group hosts \\ make it
#vim /etc/ypserv.conf
Line No: 38 & 39 * :* : shadow.byname : port
* :* : passwd.adjunct.byname : port
#vim /etc/sysconfig/network
NISDOMAIN=RHCE
#chkconfig ypserv on
#chkconfig yppasswdd on
#chkconfig ypxfrd on
#service ypserv restart
#service yppasswdd restart
#service ypxfrd restart
#nisdomainname (or) domainname
#/usr/lib/yp/ypinit –m
next host to add: server1.example.com
next host to add: 172.24.254.254
next host to add:
The current list of NIS servers looks like this:
server1.example.com
172.24.254.254
#rpcinfo -p localhost
NIS Client
#yum install ypbind*
#yum install authconfig*
#authconfig-tui
[*] Use NIS --Next
Domain: RHCE
Server: 172.24.254.254
#ypcat passwd
#vim /etc/auto.master
/rhome /etc/auto.misc
#vim /etc/auto.misc
* -rw,sync,intr 172.24.254.254:/rhome/station1/&
#chkconfig autofs on
#chkconfig ypbind on
#service ypbind restart
#service autofs restart
#su – nisuser1