Linux
Openssh config file hath
Where to find the ssh configuration file?
More often we forget path of the ssh file. Sorry we remember the ssh file path but we forget ssh configuration file name.
Path for ssh config file
# /etc/ssh/sshd_config
The /etc/ssh/sshd_config in the file path for Openssh. Some time i do configure in ..
Use conditional statement on command line
awk command to print specific line from a file
$ awk 'FNR==3' <file>
Use conditional statement on command line
$ awk '{if (NR == 3) print}' <file>
Both the above commands will print the third line from the specified file.
Sed command to get a specified line
$ ..
Ls command to list directories
Linux ls command to list directories alone
Sometime we might need to list only the directories.
ls command to list only directories
# ls -ad */
The above command will list only the directories and the hidden directories.
Output:
Desktop/ Documents/ Download/ Music/ Pictures/
ls command to list directories and ..
Linux host command to get DNS records
Linux host command
Using "host" command we shall easily get the DNS Records - MX, CNAME, A - of a domain. host commands are often used by network or linux admins to find the DNS record's. In normal the dig command is used by most of the Linux admins to find ..
Change all directory permission
Shell Script to Modify permission of all directories
Step 1: create a directory name list
eg: if you want to change all public_html directory permission to 755
$ cd /home
$ ls > /root/dir_list
step2: Copy and past it in the command prompt
$ for i ..
Check your server is hacked or not
Steps to investigate hacked linux server
Check your server is hacked or not
Following are the few to investigate whether the linux server is hacked or not:
Follow the steps one by one and analyse or check your linux server is hacked or not.
Who is on the Server:
$ w
$ netstat ..
About Semaphores
what is semaphore?
Semaphores are used to prevent processes from accessing the same resource, usually shared memory, at the same time.The number of System V semaphores configured for use is controlled by the kernel parameter SEMMNS.
SEMMNS
Number of semaphores in the system. The default and minimum value is 60. The maximum value ..
Named service down
Error Ndc: connection to remote host closed
The error ndc connection to remote host closed indicate's that the remote server is using an older version of the command protocol, this host is not authorized to connect, or the key is invalid.
Follow the steps to fix the error connection to remote host ..
Change server to local time
Changing The Timezone
In order to change the timezone please make use of the following tips,
rm -f /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Calcutta /etc/localtime
Thats it. In the above example I have chose India as my timezone. You can check your system's timezone in
cat /etc/sysconfig/clock
..
Requests for Comments (RFC)
List for Requests for Comments RFC
Requests for Comments (RFC)
RFC:
Requests for Comments -RFCs is an ongoing set of documents issued by the Internet Engineering Task Force -IETF at the Network Information Center -NIC that presents new protocols and establishes standards for the Internet protocol suite. Each such document defines an aspect ..
Disabling ssh access for root and allowing su
Disabling ssh access for root and allowing "su"
The following are the steps to disable root and enable "su" over SSH
step : 1 create a user make him a member of wheel group.(use cpanel and WHM or manually using shell)
step : 2 uncomment the following line in the file /etc/pam.d/su
auth required ..
Linux system recovery
First step towards system backup and recovery.
Sysreport is a simple tool that will backup all the critical files of a linux box.
Just run the command "sysreport" and it will backup all the critical files of the server and create a compressed tar file in the name of the server and ..
Copy or rename a file with date time stamp
Creating file with date time stamp
Many times you may need to need to create a file file with date and time stamp. It will be much helpful for the administrator when they have a copy of configuration or other files with date and time timestamp.
Command to create a file with ..
Secure SSH by blocking IP Address
Harden Server
In the last article we have seen how to secure shell by alerting through mail. You can also harden the server by blocking the certain server IP Address or by block all the IP Address except a certain IP Address so that you can login into you shell only ..
Mail alerts when someone logs into your SSH
Mail alerts when someone logs into your SSH
You can make your ssh or shell secure by alerting yourself when someone login to your ssh. Just add any one of the shell script in your profile.
Find Profile in your home directory
vi /root/.bash_profile
Script to secure SSH
echo 'ALERT - Root Shell Access (YourserverName) ..