[root@ISTELAR-DR ~]# openssl -version
openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
[root@ISTELAR-DR ~]# ll /usr/lib64/libssl*
-rwxr-xr-x 1 root root 339232 Oct 9 2018 /usr/lib64/libssl3.so
lrwxrwxrwx 1 root root 16 Sep 16 2019 /usr/lib64/libssl.so -> libssl.so.1.0.1e
-rwxr-xr-x 1 root root 324456 Mar 9 2016 /usr/lib64/libssl.so.0.9.8e
lrwxrwxrwx 1 root root 16 Sep 16 2019 /usr/lib64/libssl.so.10 -> libssl.so.1.0.1e
-rwxr-xr-x 1 root root 446344 Aug 13 2019 /usr/lib64/libssl.so.1.0.1e
lrwxrwxrwx 1 root root 16 Apr 23 2018 /usr/lib64/libssl.so.6 -> libssl.so.0.9.8e
[root@ISTELAR-DR ~]# echo $LD_LIBRARY_PATH
[root@ISTELAR-DR ~]# ll /usr/local/liblibssl*
lib/ lib64/ libexec/
[root@ISTELAR-DR ~]# ll /usr/local/lib64/libssl*
-rw-r--r-- 1 root root 1024502 May 31 19:01 /usr/local/lib64/libssl.a
lrwxrwxrwx 1 root root 13 May 31 19:01 /usr/local/lib64/libssl.so -> libssl.so.1.1
-rwxr-xr-x 1 root root 684412 May 31 19:01 /usr/local/lib64/libssl.so.1.1
-rwxr-xr-x 1 root root 766712 May 31 18:52 /usr/local/lib64/libssl.so.3
[root@ISTELAR-DR ~]# export LD_LIBRARY_PATH = /usr/local/lib64:$LD_LIBRARY_PATH
-bash: export: `=': not a valid identifier
-bash: export: `/usr/local/lib64:': not a valid identifier
[root@ISTELAR-DR ~]# export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH
[root@ISTELAR-DR ~]# ln -s /usr/local/lib64/libssl.so.1.1 /usr/lib64/libssl.so.1.1
[root@ISTELAR-DR ~]# ln -s /usr/local/lib64/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1
[root@ISTELAR-DR ~]# openssl -version
Invalid command '-version'; type "help" for a list.
[root@ISTELAR-DR ~]# openssl version
OpenSSL 1.1.1o 3 May 2022
[root@ISTELAR-DR ~]#
[root@ISTELAR-DR ~]#
[root@ISTELAR-DR ~]#
Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts
Tuesday, 31 May 2022
openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
Saturday, 30 July 2016
RHCE 7 Exam Practice with Solution Part-2 (EX 300)
7) Link Aggregation:-
--->configure your serverX and DesktopX which watches for link changes and selects on active port for data transfors.
--->ServerX should have the address as 192.168.0.100/255.255.255.0
--->DesktopX should have the address as 192.168.0.100/255.255.255.0
Solution:
[root@server7 ~]#nmcli connection show
[root@server7 ~]#nmcli connection add con-name team0 type team ifname team0 config '{"runner":{"name":"activebackup"}}'
[root@server7 ~]#teamdctl team0 state [Default is round robin here we are going to setup active backup]
[root@server7 ~]#nmcli connection modify team0 ipv4.addresses 192.168.0.100/24 ipv4.method static
[root@server7 ~]#nmcli connection down team0 ;nmcli connection up team0
[root@server7 ~]#nmcli connection add con-name team0-port1 type team-slave ifname eno33554992 master team0
[root@server7 ~]#teamdctl team0 state
[root@server7 ~]#nmcli connection add con-name team0-port2 type team-slave ifname eno50332216 master team0
[root@server7 ~]#teamdctl team0 state
[root@server7 ~]#ifdown eno33554992
[root@server7 ~]#teamdctl team0 state
[root@server7 ~]#nmcli connection up eno33554992
[root@server7 ~]#nmcli connection up team0-port1
[root@server7 ~]#teamdctl team0 state
[root@server7 ~]#nmcli connection down team0-port2
[root@server7 ~]#teamdctl team0 state
[root@server7 ~]#nmcli connection up team0-port2
[root@server7 ~]#nmcli teamdctl team0 state
Note : Do ping command ping 192.168.0.254 -t from another terminal to check status
Do the same for desktop machine also....
8) SMTP configuration
--->configure the SMTP mail service on serverX and desktopX which only reply mail from local system through station.network0.example.com
--->all outgoing mail have ther sender domain at example.com ensure that mail should not store locally.
--->Verify the mail server is woring by sender mail to a sirat user.
Solution:
[root@server7 ~]#yum install postfix
[root@server7 ~]#systemctl enable postfix
[root@server7 ~]#systemctl start postfix
--Allow smtp port into firewall---
[root@server7 ~]firewall-cmd --permanent --add-service=smtp
[root@server7 ~]firewall-cmd --reload
[root@server7 ~]firewall-cmd --list-ports
[root@server7 ~]vim /etc/postfix/main.conf
inet_interface=localhost
mydestination=
myorigin=example.com
relayhost=[station.network0.example.com]
mynetworks=127.0.0.0/8,[::1]/128
local_transport=error:local delivery disabled
[root@server7 ~]#systemctl start postfix
[root@server7 ~]#useradd sirat
[root@server7 ~]#mail -V sirat@server7.example.com [send a test mail to sirat user]
[root@server7 ~]#tail -f /var/log/maillog [check mail status]
17) script
--->create a script on serverX called /root/random with the following details
--->when run as /root/random Postconf, should bring the output as "Postroll"
--->when run as /root/random Postroll, should bring the output as "Postconf"
--->when run with only other argument or wihout argument, should bring the stderr as
"/root/random Postconf | Postroll"
Solution:
[root@server7 ~]#vim /root/random
#!/bin/bash
case $@ in
postconf ) echo "Postroll";;
Postroll ) echo "postconf";;
*) echo "/root/random postconf | Postroll";;
esac
[root@server7 ~]#chmod a+x /root/random
18) script
--->create a script on serverX called /root/createusers
--->when this script is called with the test file argument, it should add all the users from the file
--->downloaded the fire from http://station.network0.example.com/pub/testfile
--->all user should have the login shell as /bin/false, passwd not required.
--->when this script is called wih anyother argument, it should print the message "Input File Not Found"
--->When this script is run without any argument, it should dissplay "Usage "/root/createuser"
Note:- If the users are added no need to delete.
Solution:
#wget http://classroom.example.com/pub/testfile
[root@server7 ~]#vim /root/createusers
#!/bin/bash
a=""
case "$@" in
testfile ) for b in `cat testfile`
do
useradd -s /bin/false $b;
done;;
$a ) echo "Usage:/root/createusers";;
* ) echo "Input file Not Found";;
esac
[root@server7 ~]#chmod a+x /root/createusers
19) Configure SCSI storage. (Target CLI)
--->create a new 1 GB iscsi_block target on your serverX.example.com
--->The server should export on iscsi disk called iqn.2014.11.com.example.serverX.
--->This target should be only be available allowd to clients with an IQN of iqn.2014.11.com.example.desktopX.
Solution:
Server-Vm
--------
[root@server7 ~]#yum install targetcli* -y
[root@server7 ~]#systemctl enable target.service
[root@server7 ~]#systemctl start target.service
[root@server7 ~]#firewall-cmd --permanent --add-port=3260/tcp
[root@server7 ~]#firewall-cmd --reload
[root@server7 ~]#fdisk /dev/vdb [Create 1GB new partition]
:n,:p,:1,:Enter,:+1G,:w
#partprobe /dev/vdb
#cat /proc/partitions
#targetcli
>ls
>cd /backstores/block
>create block1 /dev/vdb1
>cd /iscsi
>create iqn.2014-10.com.example:serverX
>cd /iscsi/iqn.2014-10.com.example/tpg1/acls
>create iqn.2014-10.com.example:desktopX
>cd /iscsi/iqn.2014-10.com.example/tpg1/luns
>create /backstore/block/block1
>cd /iscsi/iqn.2014-10.com.example/tpg1/portals
>create 172.25.X.11/3260 ------->( server ip)
>exit
#systemctl restart target.service
20) ISCSI initiator
-The serverX.example.com provides an iscsi port (3260). connect the disk with desktopX.example.com
and configure filesystem with the following requirements,
-create 800MB partition on ISCSI blcok device and assign the filesystem as xfs.
-Mount the volume under /mnt/initiator at the system boot time.
The filesystem should contain the copy of http://classroom.example.com/pub/iscsi.txt
The file should be owned by root with 0644 permission Note: don't modify the content.
Desktop-Vm
----------
[root@server7 ~]#yum install iscsi-initiator-utils -y
[root@server7 ~]#systemctl enable iscsi.service iscsid.service
[root@server7 ~]#systemctl start iscsi.service iscsid.service
[root@server7 ~]#vim /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2014-10.com.example:desktopX
:wq
[root@server7 ~]#systemctl restart iscsi.service iscsid.service
[root@server7 ~]#systemctl start iscsi.service
[root@server7 ~]#systemctl start iscsid.service
man iscsiadm -- search with /examples and take discoverydb and login commands and modify the ipaddress.
[root@server7 ~]#iscsiadm --mode discoverydb --type sendtargets --portal 172.25.11.11 --discover
[root@server7 ~]#iscsiadm --mode node --targetname iqn.2014-06.com.example:server11 --portal 172.25.11.11:3260 --login
cat /proc/partitions
[root@server7 ~]#fdisk /dev/sdc
n,p,1,Enter,+200M,w
[root@server7 ~]#partprobe /dev/sdc
[root@server7 ~]#blkid
[root@server7 ~]#vim /etc/fstab
UUID= /media ext4 _netdev 0 0
:wq
=================
--->configure your serverX and DesktopX which watches for link changes and selects on active port for data transfors.
--->ServerX should have the address as 192.168.0.100/255.255.255.0
--->DesktopX should have the address as 192.168.0.100/255.255.255.0
Solution:
[root@server7 ~]#nmcli connection show
[root@server7 ~]#nmcli connection add con-name team0 type team ifname team0 config '{"runner":{"name":"activebackup"}}'
[root@server7 ~]#teamdctl team0 state [Default is round robin here we are going to setup active backup]
[root@server7 ~]#nmcli connection modify team0 ipv4.addresses 192.168.0.100/24 ipv4.method static
[root@server7 ~]#nmcli connection down team0 ;nmcli connection up team0
[root@server7 ~]#nmcli connection add con-name team0-port1 type team-slave ifname eno33554992 master team0
[root@server7 ~]#teamdctl team0 state
[root@server7 ~]#nmcli connection add con-name team0-port2 type team-slave ifname eno50332216 master team0
[root@server7 ~]#teamdctl team0 state
[root@server7 ~]#ifdown eno33554992
[root@server7 ~]#teamdctl team0 state
[root@server7 ~]#nmcli connection up eno33554992
[root@server7 ~]#nmcli connection up team0-port1
[root@server7 ~]#teamdctl team0 state
[root@server7 ~]#nmcli connection down team0-port2
[root@server7 ~]#teamdctl team0 state
[root@server7 ~]#nmcli connection up team0-port2
[root@server7 ~]#nmcli teamdctl team0 state
Note : Do ping command ping 192.168.0.254 -t from another terminal to check status
Do the same for desktop machine also....
8) SMTP configuration
--->configure the SMTP mail service on serverX and desktopX which only reply mail from local system through station.network0.example.com
--->all outgoing mail have ther sender domain at example.com ensure that mail should not store locally.
--->Verify the mail server is woring by sender mail to a sirat user.
Solution:
[root@server7 ~]#yum install postfix
[root@server7 ~]#systemctl enable postfix
[root@server7 ~]#systemctl start postfix
--Allow smtp port into firewall---
[root@server7 ~]firewall-cmd --permanent --add-service=smtp
[root@server7 ~]firewall-cmd --reload
[root@server7 ~]firewall-cmd --list-ports
[root@server7 ~]vim /etc/postfix/main.conf
inet_interface=localhost
mydestination=
myorigin=example.com
relayhost=[station.network0.example.com]
mynetworks=127.0.0.0/8,[::1]/128
local_transport=error:local delivery disabled
[root@server7 ~]#systemctl start postfix
[root@server7 ~]#useradd sirat
[root@server7 ~]#mail -V sirat@server7.example.com [send a test mail to sirat user]
[root@server7 ~]#tail -f /var/log/maillog [check mail status]
17) script
--->create a script on serverX called /root/random with the following details
--->when run as /root/random Postconf, should bring the output as "Postroll"
--->when run as /root/random Postroll, should bring the output as "Postconf"
--->when run with only other argument or wihout argument, should bring the stderr as
"/root/random Postconf | Postroll"
Solution:
[root@server7 ~]#vim /root/random
#!/bin/bash
case $@ in
postconf ) echo "Postroll";;
Postroll ) echo "postconf";;
*) echo "/root/random postconf | Postroll";;
esac
[root@server7 ~]#chmod a+x /root/random
18) script
--->create a script on serverX called /root/createusers
--->when this script is called with the test file argument, it should add all the users from the file
--->downloaded the fire from http://station.network0.example.com/pub/testfile
--->all user should have the login shell as /bin/false, passwd not required.
--->when this script is called wih anyother argument, it should print the message "Input File Not Found"
--->When this script is run without any argument, it should dissplay "Usage "/root/createuser"
Note:- If the users are added no need to delete.
Solution:
#wget http://classroom.example.com/pub/testfile
[root@server7 ~]#vim /root/createusers
#!/bin/bash
a=""
case "$@" in
testfile ) for b in `cat testfile`
do
useradd -s /bin/false $b;
done;;
$a ) echo "Usage:/root/createusers";;
* ) echo "Input file Not Found";;
esac
[root@server7 ~]#chmod a+x /root/createusers
19) Configure SCSI storage. (Target CLI)
--->create a new 1 GB iscsi_block target on your serverX.example.com
--->The server should export on iscsi disk called iqn.2014.11.com.example.serverX.
--->This target should be only be available allowd to clients with an IQN of iqn.2014.11.com.example.desktopX.
Solution:
Server-Vm
--------
[root@server7 ~]#yum install targetcli* -y
[root@server7 ~]#systemctl enable target.service
[root@server7 ~]#systemctl start target.service
[root@server7 ~]#firewall-cmd --permanent --add-port=3260/tcp
[root@server7 ~]#firewall-cmd --reload
[root@server7 ~]#fdisk /dev/vdb [Create 1GB new partition]
:n,:p,:1,:Enter,:+1G,:w
#partprobe /dev/vdb
#cat /proc/partitions
#targetcli
>ls
>cd /backstores/block
>create block1 /dev/vdb1
>cd /iscsi
>create iqn.2014-10.com.example:serverX
>cd /iscsi/iqn.2014-10.com.example/tpg1/acls
>create iqn.2014-10.com.example:desktopX
>cd /iscsi/iqn.2014-10.com.example/tpg1/luns
>create /backstore/block/block1
>cd /iscsi/iqn.2014-10.com.example/tpg1/portals
>create 172.25.X.11/3260 ------->( server ip)
>exit
#systemctl restart target.service
20) ISCSI initiator
-The serverX.example.com provides an iscsi port (3260). connect the disk with desktopX.example.com
and configure filesystem with the following requirements,
-create 800MB partition on ISCSI blcok device and assign the filesystem as xfs.
-Mount the volume under /mnt/initiator at the system boot time.
The filesystem should contain the copy of http://classroom.example.com/pub/iscsi.txt
The file should be owned by root with 0644 permission Note: don't modify the content.
Desktop-Vm
----------
[root@server7 ~]#yum install iscsi-initiator-utils -y
[root@server7 ~]#systemctl enable iscsi.service iscsid.service
[root@server7 ~]#systemctl start iscsi.service iscsid.service
[root@server7 ~]#vim /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2014-10.com.example:desktopX
:wq
[root@server7 ~]#systemctl restart iscsi.service iscsid.service
[root@server7 ~]#systemctl start iscsi.service
[root@server7 ~]#systemctl start iscsid.service
man iscsiadm -- search with /examples and take discoverydb and login commands and modify the ipaddress.
[root@server7 ~]#iscsiadm --mode discoverydb --type sendtargets --portal 172.25.11.11 --discover
[root@server7 ~]#iscsiadm --mode node --targetname iqn.2014-06.com.example:server11 --portal 172.25.11.11:3260 --login
cat /proc/partitions
[root@server7 ~]#fdisk /dev/sdc
n,p,1,Enter,+200M,w
[root@server7 ~]#partprobe /dev/sdc
[root@server7 ~]#blkid
[root@server7 ~]#vim /etc/fstab
UUID=
:wq
=================
Friday, 25 December 2015
Default permission of file and directory in Linux / UNIX
What is UMASK
UMASK (User Mask or User file creation MASK) is the default permission of file and directory in Linux or UNIX. There are three types of permission for every file and directory (read, write and execute) for three types of user (Owner, Groups and Others).
[wasi@saidrasel ~]]$ mkdir cde
[wasi@saidrasel ~]]$ touch abc
[wasi@saidrasel ~]$ ls -l abc
-rw-rw-r--. 1 wasi wasi 0 Dec 26 11:12 abc
-rw-rw-r--. 1 wasi wasi 0 Dec 26 11:12 abc
In the above example
- User (wasi) has read,write permission
- Group has read, write permission
- Others have read permission
Three file permissions:
read: permission to read the contents of file.
write: permission to write to the file.
execute: permission to execute the file as a program/script.
write: permission to write to the file.
execute: permission to execute the file as a program/script.
Three directory permissions:
read: permission to read the contents of directory ( view files and sub-directories in that directory ).
write: permission to write in to the directory. ( create files and sub-directories in that directory )
execute: permission to enter into that directory.
write: permission to write in to the directory. ( create files and sub-directories in that directory )
execute: permission to enter into that directory.
Numeric values for the read, write and execute permissions:
read--4
write--2
execute--1
write--2
execute--1
[wasi@saidrasel ~]$ ls -l abc
-rw-rw-r--. 1 wasi wasi 0 Dec 26 11:12 abc
-rw-rw-r--. 1 wasi wasi 0 Dec 26 11:12 abc
drwxrwxr-x. 2 wasi wasi 6 Dec 26 11:31 cde
So the numeric value permission for this file is-- 4+2 4+2 4 --->664
and the numeric value permission for the directory is-- 4+2+1 4+2+1 4+1 --->775
Umask is responsible for the default permission
[wasi@saidrasel ~]$ umask
0002
[wasi@saidrasel ~]$
0002
[wasi@saidrasel ~]$
Final default permission for a file is calculated as shown below:
Default file permission: 666
Default umask : 002
Final default file permission: 664 (666-002)
Default umask : 002
Final default file permission: 664 (666-002)
Final default permission for a directory is calculated as shown below:
Default directory permission: 777
Default umask: 002
Final default directory permission: 775 (777-002)
Default umask: 002
Final default directory permission: 775 (777-002)
We can find umask value setting from /etc/bashrc or /etc/profile
How to set access permission in a file for specific user in Linux
Files and directories have permission sets for the owner of the file, the group associated with the file, and all other users for the system. However, these permission sets have limitations. For example, different permissions cannot be configured for different users. Thus, Access Control Lists (ACLs) were implemented.
[root@saidrasel]# ll a
-rw-r--r--. 1 root root 0 Dec 25 22:56 a
Above permission means ---file owner is root have permission rw (read,write), group root have permission r (read) and other have permission r (read). Following example showing in details
[root@saidrasel]# getfacl a
# file: a
# owner: root
# group: root
user::rw-
group::r--
other::r--
Now we will set permission in file a for specific user wasi, so for this we need to create a user named wasi
[root@saidrasel]# useradd wasi
[root@saidrasel]# passwd wasi
Changing password for user wasi.
New password:
Now we will set rwx (read,write and execute) permission for new user wasi
[root@saidrasel]# setfacl -m u:wasi:rwx a
or
[root@saidrasel]# setfacl -m u:wasi:rwx /root/Desktop/a [for absolute path]
Now we can check the permission of file a for user wasi
[root@saidrasel]# getfacl a
# file: a
# owner: root
# group: root
user::rw-
user:wasi:rwx
group::r--
mask::rwx
other::r--
[root@saidrasel]#
Thats it..........
Wednesday, 23 December 2015
How to Clear Cache Memory in Linux
Find Memory Status
[root@localhost Desktop]# free -m
total used free shared buffers cached
Mem: 987 915 71 7 0 395
-/+ buffers/cache: 519 467
Swap: 1023 0 1023
In this example the total amount of available memory is 987 M. 519 M are used by processes and 467 M are free for other applications. Do not get confused by the first line which shows that 71 M are free! If you look at the usage figures you can see that most of the memory use is for buffers and cache. Linux always tries to use RAM to speed up disk operations by using available memory for buffers (file system metadata) and cache (pages with actual contents of files or block devices). This helps the system to run faster because disk information is already in memory which saves I/O operations. If space is needed by programs or applications like Oracle, then Linux will free up the buffers and cache to yield memory for the applications. If your system runs for a while you will usually see a small number under the field "free" on the first line.
Find Cache Memory uses in Linux
Use free command to find out cache memory uses by Linux system. Output of free command is like below
Last column is showing cached memory ( 395 MB) by system. -m option is used for showing memory details in MB’s.
[root@localhost Desktop]# free -m
total used free shared buffers cached
Mem: 987 915 71 7 0 395
-/+ buffers/cache: 519 467
Swap: 1023 0 1023
Following command to see much detailed information about current memory usage in 3 second interval:
[root@localhost Desktop]# watch -n 3 cat /proc/meminfo
Every 3.0s: cat /proc/meminfo Wed Dec 23 23:28:53 2015
MemTotal: 1010884 kB
MemFree: 353384 kB
MemAvailable: 367148 kB
Buffers: 40 kB
Cached: 123052 kB
SwapCached: 0 kB
Active: 427352 kB
Inactive: 83868 kB
Active(anon): 385120 kB
Inactive(anon): 11240 kB
Active(file): 42232 kB
Inactive(file): 72628 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 1048572 kB
SwapFree: 1048572 kB
Dirty: 40 kB
Writeback: 0 kB
AnonPages: 388152 kB
Mapped: 95736 kB
Shmem: 8216 kB
Slab: 67208 kB
[root@localhost Desktop]# sync; echo 1 > /proc/sys/vm/drop_caches
[root@localhost Desktop]# free -m
total used free shared buffers cached
Mem: 987 611 375 7 0 92
-/+ buffers/cache: 518 468
Swap: 1023 0 1023
2. Freeing dentries and inodes use following command
[root@localhost Desktop]# sync; echo 2 > /proc/sys/vm/drop_caches
[root@localhost Desktop]# free -m
total used free shared buffers cached
Mem: 987 594 392 7 0 93
-/+ buffers/cache: 501 485
Swap: 1023 0 1023
3. Freeing pagecache, dentries and inodes in cache memory
[root@localhost Desktop]# sync; echo 3 > /proc/sys/vm/drop_caches
[root@localhost Desktop]# free -m
total used free shared buffers cached
Mem: 987 596 391 7 0 91
-/+ buffers/cache: 504 482
Swap: 1023 0 1023
[root@localhost Desktop]#
4. Schedule Cron to Flush Cache Regularly
If we want to schedule following in crontab to automatically flush cache on regular interval.
# crontab -l
0 * * * * sync; echo 3 > /proc/sys/vm/drop_caches
The above cron will execute on every hour and flushes the cached memory on system.
[root@localhost Desktop]# free -m
total used free shared buffers cached
Mem: 987 915 71 7 0 395
-/+ buffers/cache: 519 467
Swap: 1023 0 1023
In this example the total amount of available memory is 987 M. 519 M are used by processes and 467 M are free for other applications. Do not get confused by the first line which shows that 71 M are free! If you look at the usage figures you can see that most of the memory use is for buffers and cache. Linux always tries to use RAM to speed up disk operations by using available memory for buffers (file system metadata) and cache (pages with actual contents of files or block devices). This helps the system to run faster because disk information is already in memory which saves I/O operations. If space is needed by programs or applications like Oracle, then Linux will free up the buffers and cache to yield memory for the applications. If your system runs for a while you will usually see a small number under the field "free" on the first line.
Find Cache Memory uses in Linux
Use free command to find out cache memory uses by Linux system. Output of free command is like below
Last column is showing cached memory ( 395 MB) by system. -m option is used for showing memory details in MB’s.
[root@localhost Desktop]# free -m
total used free shared buffers cached
Mem: 987 915 71 7 0 395
-/+ buffers/cache: 519 467
Swap: 1023 0 1023
Following command to see much detailed information about current memory usage in 3 second interval:
[root@localhost Desktop]# watch -n 3 cat /proc/meminfo
Every 3.0s: cat /proc/meminfo Wed Dec 23 23:28:53 2015
MemTotal: 1010884 kB
MemFree: 353384 kB
MemAvailable: 367148 kB
Buffers: 40 kB
Cached: 123052 kB
SwapCached: 0 kB
Active: 427352 kB
Inactive: 83868 kB
Active(anon): 385120 kB
Inactive(anon): 11240 kB
Active(file): 42232 kB
Inactive(file): 72628 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 1048572 kB
SwapFree: 1048572 kB
Dirty: 40 kB
Writeback: 0 kB
AnonPages: 388152 kB
Mapped: 95736 kB
Shmem: 8216 kB
Slab: 67208 kB
1. Freeing pagecache only use following command
[root@localhost Desktop]# sync; echo 1 > /proc/sys/vm/drop_caches
[root@localhost Desktop]# free -m
total used free shared buffers cached
Mem: 987 611 375 7 0 92
-/+ buffers/cache: 518 468
Swap: 1023 0 1023
2. Freeing dentries and inodes use following command
[root@localhost Desktop]# sync; echo 2 > /proc/sys/vm/drop_caches
[root@localhost Desktop]# free -m
total used free shared buffers cached
Mem: 987 594 392 7 0 93
-/+ buffers/cache: 501 485
Swap: 1023 0 1023
3. Freeing pagecache, dentries and inodes in cache memory
[root@localhost Desktop]# sync; echo 3 > /proc/sys/vm/drop_caches
[root@localhost Desktop]# free -m
total used free shared buffers cached
Mem: 987 596 391 7 0 91
-/+ buffers/cache: 504 482
Swap: 1023 0 1023
[root@localhost Desktop]#
4. Schedule Cron to Flush Cache Regularly
If we want to schedule following in crontab to automatically flush cache on regular interval.
# crontab -l
0 * * * * sync; echo 3 > /proc/sys/vm/drop_caches
The above cron will execute on every hour and flushes the cached memory on system.
Monday, 21 December 2015
Find empty file or directory in Linux
### Find empty file from current directory ###
[root@localhost ~]# find -type f -empty
./.cache/abrt/applet_dirlist
./.local/share/gnome-settings-daemon/input-sources-converted
./.local/share/folks/relationships.ini
./.local/share/.converted-launchers
./.local/share/tracker/data/.meta.isrunning
./.local/share/keyrings/user.keystore.HQQ99X
./.local/share/keyrings/user.keystore.ZUKY9X
./.local/share/keyrings/user.keystore.VG4S9X
./.local/share/keyrings/user.keystore.G00V9X
./.local/share/keyrings/user.keystore.681AAY
./.local/share/keyrings/user.keystore.A15Y9X
./.local/share/keyrings/user.keystore.7NT89X
./test/saidrasel.lst
### Find empty file from specific directory ###
[root@localhost ~]# find /root/test -type f -empty
/root/test/saidrasel.lst
[root@localhost ~]#
### Find empty directory from current location ###
[root@localhost ~]# find -type d -empty
./.cache/evolution/addressbook/trash
./.cache/evolution/calendar/trash
./.cache/evolution/mail/trash
./.cache/evolution/memos/trash
./.cache/evolution/sources/trash
./.cache/evolution/tasks/trash
./.cache/folks/avatars
./.config/imsettings
./.config/abrt
### Find empty directory from specific location ###
[root@localhost ~]# mkdir -p /home/rasel/test
[root@localhost ~]# find /home/rasel/ -type d -empty
/home/rasel/.mozilla/extensions
/home/rasel/.mozilla/plugins
/home/rasel/.config/abrt
/home/rasel/test
[root@localhost ~]#
[root@localhost ~]# mkdir -p /home/rasel/test/abc
[root@localhost ~]# find /home/rasel/ -type d -empty
/home/rasel/.mozilla/extensions
/home/rasel/.mozilla/plugins
/home/rasel/.config/abrt
/home/rasel/test/abc
[root@localhost ~]#
### Remove empty directory ###
Create empty directory using following command
[root@localhost rasel]# pwd
/home/rasel
[root@localhost rasel]# mkdir test
[root@localhost rasel]# cd test/
[root@localhost test]# mkdir abc
[root@localhost test]# pwd
/home/rasel/test
[root@localhost test]# cd /root/
[root@localhost ~]# pwd
/root
[root@localhost ~]# find /home/rasel/ -type d -empty
/home/rasel/test/abc
[root@localhost ~]# ls -la /home/rasel/test/
total 4
drwxr-xr-x. 3 root root 16 Dec 21 16:44 .
drwx------. 4 rasel rasel 4096 Dec 21 16:44 ..
drwxr-xr-x. 2 root root 6 Dec 21 16:44 abc
Now remove the empty directory
[root@localhost ~]# find /home/rasel/test/ -type d -empty -exec rmdir {} \;
find: ‘/home/rasel/test/abc’: No such file or directory
[root@localhost ~]# ls -la /home/rasel/test/
total 4
drwxr-xr-x. 2 root root 6 Dec 21 16:45 .
drwx------. 4 rasel rasel 4096 Dec 21 16:44 ..
[root@localhost ~]#
[root@localhost ~]# find -type f -empty
./.cache/abrt/applet_dirlist
./.local/share/gnome-settings-daemon/input-sources-converted
./.local/share/folks/relationships.ini
./.local/share/.converted-launchers
./.local/share/tracker/data/.meta.isrunning
./.local/share/keyrings/user.keystore.HQQ99X
./.local/share/keyrings/user.keystore.ZUKY9X
./.local/share/keyrings/user.keystore.VG4S9X
./.local/share/keyrings/user.keystore.G00V9X
./.local/share/keyrings/user.keystore.681AAY
./.local/share/keyrings/user.keystore.A15Y9X
./.local/share/keyrings/user.keystore.7NT89X
./test/saidrasel.lst
### Find empty file from specific directory ###
[root@localhost ~]# find /root/test -type f -empty
/root/test/saidrasel.lst
[root@localhost ~]#
### Find empty directory from current location ###
[root@localhost ~]# find -type d -empty
./.cache/evolution/addressbook/trash
./.cache/evolution/calendar/trash
./.cache/evolution/mail/trash
./.cache/evolution/memos/trash
./.cache/evolution/sources/trash
./.cache/evolution/tasks/trash
./.cache/folks/avatars
./.config/imsettings
./.config/abrt
### Find empty directory from specific location ###
[root@localhost ~]# mkdir -p /home/rasel/test
[root@localhost ~]# find /home/rasel/ -type d -empty
/home/rasel/.mozilla/extensions
/home/rasel/.mozilla/plugins
/home/rasel/.config/abrt
/home/rasel/test
[root@localhost ~]#
[root@localhost ~]# mkdir -p /home/rasel/test/abc
[root@localhost ~]# find /home/rasel/ -type d -empty
/home/rasel/.mozilla/extensions
/home/rasel/.mozilla/plugins
/home/rasel/.config/abrt
/home/rasel/test/abc
[root@localhost ~]#
### Remove empty directory ###
Create empty directory using following command
[root@localhost rasel]# pwd
/home/rasel
[root@localhost rasel]# mkdir test
[root@localhost rasel]# cd test/
[root@localhost test]# mkdir abc
[root@localhost test]# pwd
/home/rasel/test
[root@localhost test]# cd /root/
[root@localhost ~]# pwd
/root
[root@localhost ~]# find /home/rasel/ -type d -empty
/home/rasel/test/abc
[root@localhost ~]# ls -la /home/rasel/test/
total 4
drwxr-xr-x. 3 root root 16 Dec 21 16:44 .
drwx------. 4 rasel rasel 4096 Dec 21 16:44 ..
drwxr-xr-x. 2 root root 6 Dec 21 16:44 abc
Now remove the empty directory
[root@localhost ~]# find /home/rasel/test/ -type d -empty -exec rmdir {} \;
find: ‘/home/rasel/test/abc’: No such file or directory
[root@localhost ~]# ls -la /home/rasel/test/
total 4
drwxr-xr-x. 2 root root 6 Dec 21 16:45 .
drwx------. 4 rasel rasel 4096 Dec 21 16:44 ..
[root@localhost ~]#
Locate command in Linux
locate command search very quickly, because locate does not search the files on disk rather it searches for file paths in a database. The locate database file is located at:
[root@localhost test]# locate mlocate.db
/usr/share/man/man5/mlocate.db.5.gz
/var/lib/mlocate/mlocate.db/var/lib/mlocate/mlocate.db.UY1Pjl
[root@localhost test]#
[root@localhost test]# locate sysctl.conf
/etc/sysctl.conf
/etc/sysctl.d/99-sysctl.conf
/usr/share/man/man5/sysctl.conf.5.gz
[root@localhost test]#
Now create a directory and touch a file
[root@localhost Desktop]# mkdir -p /root/test
[root@localhost Desktop]# touch /root/test/saidrasel.lst
[root@localhost test]# locate saidrasel*
Now execute the locate command to find "saidrasel.lst" file but could'nt get
[root@localhost test]# locate saidrasel.lst
Now execute the updatedb command, it scans the whole system and updates the mlocate.db database file.
[root@localhost test]# updatedb
[root@localhost test]# locate saidrasel.lst
/root/test/saidrasel.lst
[root@localhost test]#
Note: So the limitation of the "locate" command is its dependency on the database which can be updated by another utility "updated". Hence, in order to get the latest and reliable results from "locate" command the database on which it works should be updated at regular intervals.
[root@localhost test]# locate mlocate.db
/usr/share/man/man5/mlocate.db.5.gz
/var/lib/mlocate/mlocate.db/var/lib/mlocate/mlocate.db.UY1Pjl
[root@localhost test]#
[root@localhost test]# locate sysctl.conf
/etc/sysctl.conf
/etc/sysctl.d/99-sysctl.conf
/usr/share/man/man5/sysctl.conf.5.gz
[root@localhost test]#
Now create a directory and touch a file
[root@localhost Desktop]# mkdir -p /root/test
[root@localhost Desktop]# touch /root/test/saidrasel.lst
[root@localhost test]# locate saidrasel*
Now execute the locate command to find "saidrasel.lst" file but could'nt get
[root@localhost test]# locate saidrasel.lst
Now execute the updatedb command, it scans the whole system and updates the mlocate.db database file.
[root@localhost test]# updatedb
[root@localhost test]# locate saidrasel.lst
/root/test/saidrasel.lst
[root@localhost test]#
Note: So the limitation of the "locate" command is its dependency on the database which can be updated by another utility "updated". Hence, in order to get the latest and reliable results from "locate" command the database on which it works should be updated at regular intervals.
Sunday, 20 December 2015
Find file based on access/modification time
We can find files based on following three file time attribute.
Access time of the file: Access time gets updated when the file accessed.
Modification time of the file: Modification time gets updated when the file content modified.
Change time of the file: Change time gets updated when the inode data changes
###Find files whose content got updated within last 1 hour###
[root@stelar_test oracle]# find /home/oracle -mmin -60
/home/oracle
/home/oracle/SaidRasel.c
[root@stelar_test oracle]#
-mmin n File’s data was last modified n minutes ago.
-mtime n File’s data was last modified n*24 hours ago.
[root@stelar_test oracle]# find /home/oracle -mtime -1
/home/oracle
/home/oracle/SaidRasel.c
[root@stelar_test oracle]#
###Find files which got accessed before 1 hour###
-amin n File was last accessed n minutes ago-atime n File was last accessed n*24 hours ago
Finds all the files (under /home/oracle) that got accessed within the last 24 hours (1 day).
[root@stelar_test oracle]# find /home/oracle -atime -1
/home/oracle/.ssh
/home/oracle/.oracle
/home/oracle/.oracle/logs
/home/oracle/.local
/home/oracle/.local/share
/home/oracle/.local/share/applications
/home/oracle/.local/share/gvfs-metadata
/home/oracle/.thumbnails
/home/oracle/.thumbnails/normal
/home/oracle/Downloads
/home/oracle/.gvfs
/home/oracle/.spice-vdagent
/home/oracle/.bash_profile
/home/oracle/.cache
/home/oracle/Templates
/home/oracle/tomcat jdk
/home/oracle/.dbus
/home/oracle/.dbus/session-bus
Finds all the files (under /root/test/backup) that got accessed within the last 24 hours (1 day).
[root@stelar_test oracle]# find /root/test/backup/ -atime -1
/root/test/backup/
/root/test/backup/Program.c
/root/test/backup/mycprogram.c
/root/test/backup/MyCProgram.c
/root/test/backup/saidrasel.c
/root/test/backup/MybashProgram.sh
[root@stelar_test oracle]#
Find files in the current directory and sub-directories, which got accessed within last 1 hour (60 minutes)
[root@stelar_test oracle]# find -amin -60
.
./SaidRasel.c
./.bash_history
[root@stelar_test oracle]#
Find files in the current directory and sub-directories, which got accessed within last 1 hour (60 minutes)
[root@stelar_test oracle]# find /home/oracle/ -amin -60
/home/oracle/
/home/oracle/SaidRasel.c
/home/oracle/.bash_history
[root@stelar_test oracle]#
-amin n File was last accessed n minutes ago
-atime n File was last accessed n*24 hours ago
###Find files which got changed before 1 hour###
-cmin n File’s status was last changed n minutes ago.
-ctime n File’s status was last changed n*24 hours ago.
find files in the current directory and sub-directories, which changed within last 1 hour (60 minutes)
[root@stelar_test oracle]# find /home/oracle/ -cmin -60
/home/oracle/
/home/oracle/SaidRasel.c
/home/oracle/.bash_history
[root@stelar_test oracle]# find . -cmin -60
.
./SaidRasel.c
./.bash_history
[root@stelar_test oracle]#
finds all the files (under /root/test/backup/) that got changed within the last 24 hours (1 day).
[root@stelar_test oracle]# find /root/test/backup/ -ctime -1
/root/test/backup/
/root/test/backup/Program.c
/root/test/backup/mycprogram.c
/root/test/backup/MyCProgram.c
/root/test/backup/saidrasel.c
/root/test/backup/MybashProgram.sh
[root@stelar_test oracle]#
Reference :
http://www.thegeekstuff.com/2009/06/15-practical-unix-linux-find-command-examples-part-2/
Find files using file name in Linux
create two file named saidrasel.c into current directory /root/test and /root/test/backup directory
[root@stelar_test test]# touch saidrasel.c
[root@stelar_test test]# cd backup/
[root@stelar_test backup]# touch saidrasel.c
Now execute the find command to search saidrasel.c file from /root/test location
[root@stelar_test test]#pwd
/root/test
[root@stelar_test test]# find -name saidrasel.c
./backup/saidrasel.c
./saidrasel.c
[root@stelar_test test]#
Now execute the find command to search saidrasel.c file from / location
[root@stelar_test /]# find -name saidrasel.c
./root/test/backup/saidrasel.c
./root/test/saidrasel.c
[root@stelar_test /]#
Now execute the find command to search saidrasel.c file from any location
[root@stelar_test oracle]# pwd
/home/oracle
Following search will start from / (root) location
[root@stelar_test oracle]# find / -name saidrasel.c
/root/test/backup/saidrasel.c
/root/test/saidrasel.c
[root@stelar_test oracle]#
[root@stelar_test oracle]# find / -name saidrasel*
/root/test/backup/saidrasel.c
/root/test/saidrasel.c
[root@stelar_test oracle]# find / -name saidrase*
/root/test/backup/saidrasel.c
/root/test/saidrasel.c
[root@stelar_test oracle]# find / -name saidra*
/root/test/backup/saidrasel.c
/root/test/saidrasel.c
[root@stelar_test oracle]#
Find Files Using Name and Ignoring Case
[root@stelar_test oracle]# find / -iname "SaidRasel.c"
/home/oracle/SaidRasel.c
/root/test/SaidRasel.c
/root/test/backup/saidrasel.c
/root/test/saidrasel.c
[root@stelar_test oracle]#
[root@stelar_test test]# touch saidrasel.c
[root@stelar_test test]# cd backup/
[root@stelar_test backup]# touch saidrasel.c
Now execute the find command to search saidrasel.c file from /root/test location
[root@stelar_test test]#pwd
/root/test
[root@stelar_test test]# find -name saidrasel.c
./backup/saidrasel.c
./saidrasel.c
[root@stelar_test test]#
Now execute the find command to search saidrasel.c file from / location
[root@stelar_test /]# find -name saidrasel.c
./root/test/backup/saidrasel.c
./root/test/saidrasel.c
[root@stelar_test /]#
Now execute the find command to search saidrasel.c file from any location
[root@stelar_test oracle]# pwd
/home/oracle
Following search will start from / (root) location
[root@stelar_test oracle]# find / -name saidrasel.c
/root/test/backup/saidrasel.c
/root/test/saidrasel.c
[root@stelar_test oracle]#
[root@stelar_test oracle]# find / -name saidrasel*
/root/test/backup/saidrasel.c
/root/test/saidrasel.c
[root@stelar_test oracle]# find / -name saidrase*
/root/test/backup/saidrasel.c
/root/test/saidrasel.c
[root@stelar_test oracle]# find / -name saidra*
/root/test/backup/saidrasel.c
/root/test/saidrasel.c
[root@stelar_test oracle]#
Find Files Using Name and Ignoring Case
[root@stelar_test oracle]# find / -iname "SaidRasel.c"
/home/oracle/SaidRasel.c
/root/test/SaidRasel.c
/root/test/backup/saidrasel.c
/root/test/saidrasel.c
[root@stelar_test oracle]#
[root@stelar_test oracle]# find / -iname "saidrasel.c"
/home/oracle/SaidRasel.c
/root/test/SaidRasel.c
/root/test/backup/saidrasel.c
/root/test/saidrasel.c
[root@stelar_test oracle]#
/home/oracle/SaidRasel.c
/root/test/SaidRasel.c
/root/test/backup/saidrasel.c
/root/test/saidrasel.c
[root@stelar_test oracle]#
Tuesday, 15 December 2015
Directory or File Permission in Linux
For Example---
[oracle@sbldb2 ~]$ ll
total 516
-rw-r--r-- 1 oracle oinstall 235340 Nov 2 11:50 02112015.lst
-rw-r--r-- 1 oracle oinstall 257702 Sep 8 2014 awrrpt_1_7407_7409.txt
drwxr-xr-x 2 oracle oinstall 4096 Mar 12 2014 Desktop
-rw-r--r-- 1 oracle oinstall 364 Apr 1 2014 Dhaka.bkp
drwxr-xr-x 3 oracle oinstall 4096 Mar 23 2014 oradiag_oracle
drwxr-xr-x 4 oracle oinstall 4096 Sep 2 15:45 rman
-rw-r--r-- 1 oracle oinstall 3965 Jan 5 2015 tuning.sql
Total 10 fields in prefix of every files and directory as above
Here
user ---> oracle
group ---> oinstall
-rwxr-xr-x
1st filed represents ---> Directory
2nd,3rd and 4th filed represent ---> Owner Permission
5th,6th and 7th filed represent ---> Group Member Permission
8th,9th and 10th field represent ---> Other Permission
You can setup following mode on each files. In a Linux and UNIX set of permissions is called as mode:
Read (r)
Write (w)
Execute (x)
Linux Read mode permissions
--Read access on a file allows you to view file
--Read access on a directory allows you to view directory contents with ls command
Write mode permissions
--Write access on a file allows you to write to file
--Write access on a directory allows you to remove or add new files
Execute mode permissions
--Execute access on a file allows to run program or script
--Execute access on a directory allows you access file in the directory
Octal numbers and permissions
You can use octal number to represent mode/permission:
r: 4
w: 2
x: 1
Use above method to calculate permission for group and others. Let us say you wish to give full permission to owner, read & execute permission to group, and read only permission to others, then you need to calculate permission as follows:
-rwx-rw--x-- 1 oracle oinstall 3965 Jan 5 2015 tuning.sql
User (oracle) = r+w+x = 4+2+1 = 7
Group (oinstall) = r+w = 4+2+0 = 6
Others = r= 4+0+0 = 4
Effective permission is 764.
[oracle@sbldb2 ~]$ ll
total 516
-rw-r--r-- 1 oracle oinstall 235340 Nov 2 11:50 02112015.lst
-rw-r--r-- 1 oracle oinstall 257702 Sep 8 2014 awrrpt_1_7407_7409.txt
drwxr-xr-x 2 oracle oinstall 4096 Mar 12 2014 Desktop
-rw-r--r-- 1 oracle oinstall 364 Apr 1 2014 Dhaka.bkp
drwxr-xr-x 3 oracle oinstall 4096 Mar 23 2014 oradiag_oracle
drwxr-xr-x 4 oracle oinstall 4096 Sep 2 15:45 rman
-rw-r--r-- 1 oracle oinstall 3965 Jan 5 2015 tuning.sql
Total 10 fields in prefix of every files and directory as above
Here
user ---> oracle
group ---> oinstall
-rwxr-xr-x
1st filed represents ---> Directory
2nd,3rd and 4th filed represent ---> Owner Permission
5th,6th and 7th filed represent ---> Group Member Permission
8th,9th and 10th field represent ---> Other Permission
You can setup following mode on each files. In a Linux and UNIX set of permissions is called as mode:
Read (r)
Write (w)
Execute (x)
Linux Read mode permissions
--Read access on a file allows you to view file
--Read access on a directory allows you to view directory contents with ls command
Write mode permissions
--Write access on a file allows you to write to file
--Write access on a directory allows you to remove or add new files
Execute mode permissions
--Execute access on a file allows to run program or script
--Execute access on a directory allows you access file in the directory
Octal numbers and permissions
You can use octal number to represent mode/permission:
r: 4
w: 2
x: 1
Use above method to calculate permission for group and others. Let us say you wish to give full permission to owner, read & execute permission to group, and read only permission to others, then you need to calculate permission as follows:
-rwx-rw--x-- 1 oracle oinstall 3965 Jan 5 2015 tuning.sql
User (oracle) = r+w+x = 4+2+1 = 7
Group (oinstall) = r+w = 4+2+0 = 6
Others = r= 4+0+0 = 4
Effective permission is 764.
Saturday, 12 December 2015
Server uptime command in Linux
[root@stelar_test ~]# uptime
13:37:01 up 15 days, 16:47, 1 user, load average: 0.11, 0.05, 0.01
The uptime command gives a one line display of the following information.
-The current time (13:37:01)
-How long the system has been running (up 15 days)
-How many users are currently logged on (1 user)
-The system load averages for the past 1, 5, and 15 minutes (0.11, 0.05, 0.01)
This is the same information contained in the header line displayed by the w and top commands:
[root@stelar_test ~]# w
13:37:05 up 15 days, 16:47, 1 user, load average: 0.10, 0.05, 0.01
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 192.168.201.94 11:41 0.00s 0.05s 0.00s w
[root@stelar_test ~]# top
top - 13:37:51 up 15 days, 16:47, 1 user, load average: 0.05, 0.04, 0.00
Tasks: 208 total, 1 running, 207 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.5%us, 0.4%sy, 0.0%ni, 98.0%id, 1.1%wa, 0.0%hi, 0.1%si, 0.0%st
Mem: 4791876k total, 4635552k used, 156324k free, 81896k buffers
Swap: 8388600k total, 57012k used, 8331588k free, 3932264k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
26884 root 20 0 15084 1188 832 R 2.0 0.0 0:00.01 top
1 root 20 0 19400 788 580 S 0.0 0.0 0:08.90 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root RT 0 0 0 0 S 0.0 0.0 0:00.02 migration/0
4 root 20 0 0 0 0 S 0.0 0.0 0:00.89 ksoftirqd/0
5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
6 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
7 root RT 0 0 0 0 S 0.0 0.0 0:00.03 migration/1
8 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/1
9 root 20 0 0 0 0 S 0.0 0.0 0:02.85 ksoftirqd/1
10 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/1
11 root 20 0 0 0 0 S 0.0 0.0 0:02.38 events/0
12 root 20 0 0 0 0 S 0.0 0.0 7:39.35 events/1
13 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuset
14 root 20 0 0 0 0 S 0.0 0.0 0:00.00 khelper
13:37:01 up 15 days, 16:47, 1 user, load average: 0.11, 0.05, 0.01
The uptime command gives a one line display of the following information.
-The current time (13:37:01)
-How long the system has been running (up 15 days)
-How many users are currently logged on (1 user)
-The system load averages for the past 1, 5, and 15 minutes (0.11, 0.05, 0.01)
This is the same information contained in the header line displayed by the w and top commands:
[root@stelar_test ~]# w
13:37:05 up 15 days, 16:47, 1 user, load average: 0.10, 0.05, 0.01
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 192.168.201.94 11:41 0.00s 0.05s 0.00s w
[root@stelar_test ~]# top
top - 13:37:51 up 15 days, 16:47, 1 user, load average: 0.05, 0.04, 0.00
Tasks: 208 total, 1 running, 207 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.5%us, 0.4%sy, 0.0%ni, 98.0%id, 1.1%wa, 0.0%hi, 0.1%si, 0.0%st
Mem: 4791876k total, 4635552k used, 156324k free, 81896k buffers
Swap: 8388600k total, 57012k used, 8331588k free, 3932264k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
26884 root 20 0 15084 1188 832 R 2.0 0.0 0:00.01 top
1 root 20 0 19400 788 580 S 0.0 0.0 0:08.90 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root RT 0 0 0 0 S 0.0 0.0 0:00.02 migration/0
4 root 20 0 0 0 0 S 0.0 0.0 0:00.89 ksoftirqd/0
5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
6 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
7 root RT 0 0 0 0 S 0.0 0.0 0:00.03 migration/1
8 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/1
9 root 20 0 0 0 0 S 0.0 0.0 0:02.85 ksoftirqd/1
10 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/1
11 root 20 0 0 0 0 S 0.0 0.0 0:02.38 events/0
12 root 20 0 0 0 0 S 0.0 0.0 7:39.35 events/1
13 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuset
14 root 20 0 0 0 0 S 0.0 0.0 0:00.00 khelper
Booting Processes/Sequences of RHEL 7
A quick view of booting sequence:
- Power on
- CPU jumps to BIOS
- BIOS runs POST
- Finds first bootable device
- Load and execute MBR
- Load OS
- User prompt
This a rough idea what happens in Linux booting. Below are the detailed stages in Linux Booting process.
Stages of Booting:
1)System startup(Hardware )
2)Boot loader Stage 1 (MBR loading)
3)Boot loader Stage 2 (GRUB loader)
4)Kernel
5)INIT
6)User prompt
Step 1: System startup
This is the first stage of booting process. When you power on/Restart your machine the power is supplied to SMPS (switched-mode power supply) which converts AC to DC. The DC power is supplied to all the devices connected to that machine such as Motherboard HDD's, CD/DVD-ROM, Mouse, keyboard etc. The most intelligent device in the computer is Processor(CPU), when supplied with power will start running its sequence operations stored in its memory. The first instruction it will run is to pass control to BIOS(Basic Input/Output System) to do POST(Power On Self Test). Once the control goes to BIOS it will take care of two things
Run POST operation.
Selecting first Boot device.
POST operation: POST is a processes of checking hardware availability. BIOS will have a list of all devices which are present in previous system boot. In order to check if a hardware is available for the present booting or not it will send an electric pulse to each and every device in the list that it already have. If an electrical pulse is returned from that device it will come to a conclusion the hardware is working fine and ready for use. If it does not receive a single from a particular device it will treat that device as faulty or it was removed from the system. If any new hardware is attached to the system it will do the same operation to find if its available or not. The new list will be stored in BIOS memory for next boot.
Selecting First Boot Device: Once the POST is completed BIOS will have the list of devices available. BIOS memory will have the next steps details like what is the first boot device it has to select etc. It will select the first boot device and gives back the control to Processor(CPU). Suppose if it does not find first boot device, it will check for next boot device, if not third and so on. If BIOS do not find any boot device it will alert user stating "No boot device found".
Step 2: The Master Boot Record
In case of hard disks and many other mass storage media, the boot sector is MBR. MBR consists of 512 bytes at the first sector of the hard disk. It is important to note that MBR is not located inside any partition. MBR precedes the first partition. The layout of MBR is as follows:
• First 446 bytes contain bootable code.
• Next 64 bytes contain partition information for 4 partitions (16x4). That is why the hard disks can have only 4 primary partitions, as the MBR can store information for 4 partitions only. So if you need more than 4 partitions on the hard disk, one of the primary partition has to be made extended, and out of this extended partition, logical partitions are created.
• Last 2 bytes are for MBR signature, also called magic number. (Thus total of 446 + 64 + 2 = 512 bytes).
• Next 64 bytes contain partition information for 4 partitions (16x4). That is why the hard disks can have only 4 primary partitions, as the MBR can store information for 4 partitions only. So if you need more than 4 partitions on the hard disk, one of the primary partition has to be made extended, and out of this extended partition, logical partitions are created.
• Last 2 bytes are for MBR signature, also called magic number. (Thus total of 446 + 64 + 2 = 512 bytes).
|=================|======|======|======|======|===|
| 446 | 16 | 16 | 16 | 16 | 2 |
|=================|======|======|======|======|===|
| 446 | 16 | 16 | 16 | 16 | 2 |
|=================|======|======|======|======|===|
The first 446 bytes of MBR contain the code that locates the partition to boot from. The rest of booting process takes place from that partition. This partition contains a software program for booting the system called the 'bootloader'.
Step 3: Boot loader Stage 2 (GRUB loader)
Once the Bootloader stage 1 is completed and able to find the actual bootloader location, Stage 1 bootloader start second stage by loading Bootloader into memory. In this stage GRUB(Grand Unified Bootloader) which is located in the first 30 kilobytes of hard disk immediately following the MBR is loaded into RAM for reading its configuration and displays the GRUB boot menu (where the user can manually specify the boot parameters) to the user. GRUB loads the user-selected (or default) kernel into memory and passes control on to the kernel. If user do not select the OS, after a defined timeout GRUB will load the default kernel in the memory for starting it.
Step 4: Kernel
Once the control is given to kernel which is the central part of all your OS and act as a mediator of hardware and software components. Kernel once loaded into to RAM it always resides on RAM until the machine is shutdown. Once the Kernel starts its operations the first thing it do is executing INIT process.
Step 5: INIT
‘init’ is the first process started by kernel (initialization process). It is parent of all processes. The PID (Process ID) of init process is always 1. This process persists till the computer halts. It is responsible for the whole state of system. The settings for this process are stored in its configuration file, /etc/inittab (system initialization table).Before diving deeper into the details of this file and proceeding any further with the boot process, let’s discuss about runlevels
Step 6: Runlevels
Runlevel is the state in which a system boots. It can boot in a single user mode, multiuser mode, with networking, and with graphics etc. Following are the default runlevels defined by Linux:
0: Halt or shutdown the system
1: Single user mode
2: Multi-user mode, without networking
3: Full multi user mode, with NFS (typical for servers)
4: Officially not defined; Unused
5: Full multi user with NFS and graphics (typical for desktops)
6: Reboot
References:
http://linoxide.com/booting/boot-process-of-linux-in-detail/
http://www.linuxnix.com/linux-booting-process-explained/
Wednesday, 10 June 2015
Step by step to configure Samba in RHEL 6
Step 1: Install necessary RPM
[root@stelar_test repodata]# ls -lrt sam*
-r--r--r--. 1 root root 30556 Aug 17 2010 samyak-malayalam-fonts-1.2.1-9.el6.noarch.rpm
-r--r--r--. 1 root root 49496 Aug 17 2010 samyak-gujarati-fonts-1.2.1-9.el6.noarch.rpm
-r--r--r--. 1 root root 18328 Aug 17 2010 samyak-fonts-common-1.2.1-9.el6.noarch.rpm
-r--r--r--. 1 root root 61720 Aug 17 2010 samyak-devanagari-fonts-1.2.1-9.el6.noarch.rpm
-r--r--r--. 1 root root 26936 Aug 17 2010 samyak-tamil-fonts-1.2.1-9.el6.noarch.rpm
-r--r--r--. 1 root root 66000 Aug 17 2010 samyak-oriya-fonts-1.2.1-9.el6.noarch.rpm
-r--r--r--. 1 root root 1116684 Nov 3 2011 samba-winbind-clients-3.5.10-114.el6.i686.rpm
-r--r--r--. 1 root root 13918292 Nov 3 2011 samba-common-3.5.10-114.el6.i686.rpm
-r--r--r--. 1 root root 1119920 Nov 3 2011 samba-winbind-clients-3.5.10-114.el6.x86_64.rpm
-r--r--r--. 1 root root 13999076 Nov 3 2011 samba-common-3.5.10-114.el6.x86_64.rpm
-r--r--r--. 1 root root 5217032 Nov 3 2011 samba-3.5.10-114.el6.x86_64.rpm
-r--r--r--. 1 root root 3726432 Nov 3 2011 samba-winbind-3.5.10-114.el6.x86_64.rpm
-r--r--r--. 1 root root 11488144 Nov 3 2011 samba-client-3.5.10-114.el6.x86_64.rpm
[root@stelar_test repodata]# rpm -Uvh samba-3.5.10-114.el6.x86_64.rpm
warning: samba-3.5.10-114.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:samba ########################################### [100%]
[root@stelar_test repodata]# rpm -Uvh samba-common-3.5.10-114.el6.x86_64.rpm
warning: samba-common-3.5.10-114.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
package samba-common-0:3.5.10-114.el6.x86_64 is already installed
[root@stelar_test repodata]# rpm -Uvh samba-winbind-3.5.10-114.el6.x86_64.rpm
warning: samba-winbind-3.5.10-114.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:samba-winbind ########################################### [100%]
Samba Daemons
For Samba we need three services to run, one optional and two required
Service Daemons Description
Required smb smbd (SMB/CIFS Server) main samba service which provide user authentication and authorization and file and printer sharing
Required nmb nmbd (NetBIOS name server) Resources browsing
Optional winbind winbindd For host and user name resolution
Step 2: If you have just installed RPM than these service would be stopped.
[root@stelar_test repodata]# service smb status
smbd is stopped
[root@stelar_test repodata]# service nmb status
nmbd is stopped
[root@stelar_test repodata]# service winbind status
winbindd is stopped
Step 3: Start necessary services
[root@stelar_test repodata]# service smb start
Starting SMB services: [ OK ]
[root@stelar_test repodata]# service nmb start
Starting NMB services: [ OK ]
[root@stelar_test repodata]# service winbind start
Starting Winbind services: [ OK ]
Step 4: Make sure the services are running at the next time Linux is booted
[root@stelar_test repodata]# chkconfig smb on
[root@stelar_test repodata]# chkconfig nmb on
[root@stelar_test repodata]# chkconfig winbind on
[root@stelar_test repodata]#
Step 5: Creating Samba Test Directory and Files
mkdir /smbdemo
Step 6: Change the permissions on the new directory to 770 with the following command:
chmod 770 /smbdemo
Step 7: Adding the Samba User and Creating the Samba Group
# adduser administrator
# passwd administrator
Changing password for user administrator
New UNIX password: ********
Retype new UNIX password: ********
passwd: all authentication tokens updated successfully.
You must add users to the Samba database in order for them to have access to their home directory and other Samba shares.
Step 8: Now open main configuration file of Samba
[root@stelar_test pen]# vim /etc/samba/smb.conf
[backup_cbs_usb]
comment= Linux Share Samba
path=/mnt/pen
browsable=yes
guest ok=yes
read only=no
create mask=0755
Note : Change the security value to share
security = share
passdb backend = tdbsam
Step 9: Now restart the samba service
[root@stelar_test pen]# service smb restart
Shutting down SMB services: [ OK ]
Starting SMB services: [ OK ]
Step 10: Now browse the samba directory from windows PC
\\192.168.10.177\backup_cbs_usb
Tuesday, 26 May 2015
Step by Step : How to configure YUM Server in RHEL6
Make directories yum/rhel6/repodata in the folder which you have chosen for repository.
For FTP server it would be /var/ftp/pub folder
[root@dpdcdb repodata]# mkdir -p /var/ftp/pub/yum/rhel6/repodata/
Copy all RPM from RHEL 6 DVD located in Packages folder to [root@dpdcdb repodata]#
[root@dpdcdb repodata]# cp -arf /media/RHEL_6.2\ x86_64\ Disc\ 1/Packages/*.rpm /var/ftp/pub/yum/rhel6/repodata/
root@dpdcdb repodata]# cp /media/RHEL_6.2\ x86_64\ Disc\ 1/repodata/*comps*.xml /var/ftp/pub/yum/rhel6/repodata/comps.xml
[root@dpdcdb repodata]#
[root@dpdcdb RHEL_6.2 x86_64 Disc 1]# cd Server/
[root@dpdcdb Server]# rpm -qa deltarpm
[root@dpdcdb Server]# rpm -qa python-deltarpm
[root@dpdcdb Server]# rpm -qa createrepo
[root@dpdcdb Server]# pwd
/media/RHEL_6.2 x86_64 Disc 1/Server
[root@dpdcdb Server]#
[root@dpdcdb Server]# cd /var/ftp/pub/yum/rhel6/repodata/
[root@dpdcdb repodata]# rpm -ivh deltarpm*
warning: deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:deltarpm ########################################### [100%]
[root@dpdcdb repodata]#
[root@dpdcdb repodata]# rpm -ivh python-deltarpm*
warning: python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:python-deltarpm ########################################### [100%]
[root@dpdcdb repodata]#
[root@dpdcdb repodata]# rpm -ivh createrepo*
warning: createrepo-0.9.8-4.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:createrepo ########################################### [100%]
[root@dpdcdb repodata]#
[root@dpdcdb repodata]# rpm -qa createrepo
createrepo-0.9.8-4.el6.noarch
[root@dpdcdb repodata]# rpm -qa python-deltarpm
python-deltarpm-3.5-0.5.20090913git.el6.x86_64
[root@dpdcdb repodata]# rpm -qa deltarpm
deltarpm-3.5-0.5.20090913git.el6.x86_64
[root@dpdcdb repodata]#
Change directory to /var/ftp/pub/yum/rhel6
[root@dpdcdb repodata]# cd ../
[root@dpdcdb rhel6]# ll
total 248
drwxr-xr-x. 2 root root 253952 May 26 15:50 repodata
[root@dpdcdb rhel6]#
Generate local repository files from repodata folder [ repodata folder :- which contain all RPM copied from RHEL6 DVD] to current folder [rhel6]
[root@dpdcdb rhel6]# createrepo -g repodata/comps
comps-extras-17.8-1.el6.noarch.rpm comps.xml
[root@dpdcdb rhel6]# createrepo -g repodata/comps.xml .
979/3596 - repodata/oxygen-icon-theme-4.3.4-2.el6.noarch.rpm
iso-8859-1 encoding on Ville Skyttä
3596/3596 - repodata/qpid-cpp-client-0.12-6.el6.i686.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@dpdcdb rhel6]#
[root@dpdcdb rhel6]# vim /etc/yum.repos.d/server.repo
[server]
name=rhel6
baseurl=file:///var/ftp/pub/yum/rhel6
enabled=1
gpgcheck=0
[root@dpdcdb rhel6]# vim /etc/yum.repos.d/server.repo
[root@dpdcdb rhel6]# yum clean all
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Cleaning repos: InstallMedia server
Cleaning up Everything
[root@dpdcdb rhel6]#
[root@dpdcdb rhel6]# yum makechace
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
No such command: makechace. Please use /usr/bin/yum --help
[root@dpdcdb rhel6]#
Monday, 4 August 2014
Configure Yum repository in Linux
Create a folder in the server.
mkdir -p /var/ftp/pub/Server
Copy all RPMs from Linux DVD to Here.
Create the base repository headers:
cd /var/ftp/pub/Server/
rpm –ivh createrepo*
Paste database file to /tmp location
cd repodata/
cp comps* /tmp/comps.xml
Create repository
createrepo –g /tmp/comps.xml /var/ftp/pub/Server
Add your local repo to the list
cd /etc/yum.repos.d/
rm *
touch server.repo
Edit the File server.repo:
[server]
name= My Local Repo
baseurl=file:///var/ftp/pub/Server
enabled=1
gpgcheck=0
mkdir -p /var/ftp/pub/Server
Copy all RPMs from Linux DVD to Here.
Create the base repository headers:
cd /var/ftp/pub/Server/
rpm –ivh createrepo*
Paste database file to /tmp location
cd repodata/
cp comps* /tmp/comps.xml
Create repository
createrepo –g /tmp/comps.xml /var/ftp/pub/Server
Add your local repo to the list
cd /etc/yum.repos.d/
rm *
touch server.repo
Edit the File server.repo:
[server]
name= My Local Repo
baseurl=file:///var/ftp/pub/Server
enabled=1
gpgcheck=0
Sunday, 16 February 2014
Procedure to reset root password if you are using GRUB as a boot loader
Procedure to reset root password if you are using GRUB as a boot loader
1. Select the kernel
2. Press the e key to edit the entry
3. Select second line (the line starting with the word kernel)
4. Press the e key to edit kernel entry so that you can append single user mode
5. Append the letter S (or word Single) to the end of the (kernel) line
6. Press ENTER key
7. Now press the b key to boot the Linux kernel into single user mode
8. At prompt type passwd command to reset password:
Ref:
http://www.cyberciti.biz/faq/linux-reset-forgotten-root-password/
Recovering Linux Grub Boot Loader Password
1. Use Knoppix cd
2. Remove the password from Grub configuration file
3. Reboot the system
4. Change the root password
5. Setup new Grub password if required (optional)
Ref:
http://www.cyberciti.biz/tips/howto-recovering-grub-boot-loader-password.html
Tuesday, 4 February 2014
How to check CRON log in Linux
How to check CRON log in Linux
Step1: Login as root user
Step2: Check that if any cron job exist or not
[oracle@testdb64 ~]#crontab -e
59 23 * * * /home/rman/oracle_backup.sh
Step3: Check the cron log using following command
[root@testdb64 ~]# tail /var/log/cron
Feb 5 10:30:01 testdb64 crond[17638]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Feb 5 10:40:01 testdb64 crond[18670]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Feb 5 10:50:01 testdb64 crontab[19725]: (oracle) DELETE (oracle)
Feb 5 10:50:01 testdb64 crond[19729]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Feb 5 10:50:04 testdb64 crontab[19734]: (oracle) LIST (oracle)
Feb 5 10:50:37 testdb64 crontab[19785]: (oracle) BEGIN EDIT (oracle)
Feb 5 10:50:44 testdb64 crontab[19785]: (oracle) END EDIT (oracle)
Feb 5 10:51:45 testdb64 crontab[19934]: (oracle) LIST (oracle)
Feb 5 10:52:26 testdb64 crontab[19984]: (oracle) BEGIN EDIT (oracle)
Feb 5 10:52:30 testdb64 crontab[19984]: (oracle) END EDIT (oracle)
[root@testdb64 ~]#
Cron log contains the following information:
Timestamp – The date and time when the cron job was executed
Hostname – The hostname of the server (For example, dev-db)
The cron deamon name and the PID. For example, crond[20399]
Username – The username under which this cron job got executed. For example, john.
CMD – Anything following this is the real command that got executed at that time.
Monday, 3 February 2014
Step by Step Mount USB in Linux
Step by Step Mount USB in Linux
Step1: Check all mount points in this server
[root@oracledbdr1 ~]# fdisk -l
-bash: fdisk: command not found
[root@oracledbdr1 ~]#
--If the above command not found try the following---
Step2: Check all mount points in this server
[root@oracledbdr1 ~]# /sbin/fdisk -l
Disk /dev/sda: 1197.7 GB, 1197759004672 bytes
255 heads, 63 sectors/track, 145619 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 25 200781 83 Linux
/dev/sda2 83017 145619 502858597+ 83 Linux
/dev/sda3 26 62491 501758145 83 Linux
/dev/sda4 62492 83016 164867062+ 5 Extended
/dev/sda5 62492 72052 76798701 83 Linux
/dev/sda6 72053 78426 51199123+ 83 Linux
/dev/sda7 78427 80976 20482843+ 83 Linux
/dev/sda8 80977 83016 16386268+ 82 Linux swap / Solaris
Partition table entries are not in disk order
Disk /dev/sdb: 2000.3 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 243201 1953512001 83 Linux
[root@oracledbdr1 ~]#
Step3: Create a directory to mount the usb
[root@oracledbdr1 ~]# mkdir /mnt/usb
Step4: Mount the usb
[root@oracledbdr1 ~]# mount /dev/sdb1 /mnt/usb
Step5: Check the usb mounted or not
[oracle@oracledbdr1 rman_live]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 71G 3.3G 65G 5% /
/dev/sda7 19G 6.6G 12G 37% /home
/dev/sda2 465G 206G 236G 47% /back
/dev/sda6 48G 181M 45G 1% /tmp
/dev/sda3 464G 385G 56G 88% /oracledb
/dev/sda1 190M 12M 169M 7% /boot
tmpfs 7.9G 0 7.9G 0% /dev/shm
/dev/sdb1 1.8T 805G 937G 47% /mnt/usb
[oracle@oracledbdr1 rman_live]$
Wednesday, 22 January 2014
File Permissions Command in Linux
File Permissions Command in Linux
Description:
chmod octal file -change the permissions of file to octal, which can be found separately for user, group, and world by adding:
● 4 – read (r)
● 2 – write (w)
● 1 – execute (x)
Examples:
chmod 777 -read, write, execute for all
chmod 755 -rwx for owner, rx for group and world For more options, see man chmod.
chown user:group file -change the owner and group for a file
Wednesday, 8 January 2014
Allow port in Linux Server
Error : Telnet a port 2001 in 192.168.20.174 server but connection refused
Solution:
1. Check /etc/services location
[root@PhoenixBackup ~]# grep -w 2001 /etc/services
dc 2001/tcp
wizard 2001/udp # curry
m3ua 2905/udp # De-registered (2001 June 07)
sua 14001/udp # De-Registered (2001 June 06)
ATMlen 2001/tcp
[root@PhoenixBackup ~]#
2. If the port exist in /etc/services then allow it into Firewall
vi /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 2001 -j ACCEPT
3. Save and close the file. Restart iptables:
# /etc/init.d/iptables restart
Cheers.....
Solution:
1. Check /etc/services location
[root@PhoenixBackup ~]# grep -w 2001 /etc/services
dc 2001/tcp
wizard 2001/udp # curry
m3ua 2905/udp # De-registered (2001 June 07)
sua 14001/udp # De-Registered (2001 June 06)
ATMlen 2001/tcp
[root@PhoenixBackup ~]#
2. If the port exist in /etc/services then allow it into Firewall
vi /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 2001 -j ACCEPT
3. Save and close the file. Restart iptables:
# /etc/init.d/iptables restart
Cheers.....
Subscribe to:
Posts (Atom)