This is a really useful tutorial for setting up DenyHosts to protect against brute force ssh attacks.
http://www.cyberciti.biz/faq/rhel-linux-block-ssh-dictionary-brute-force-attacks/
DenyHosts homepage:
http://denyhosts.sourceforge.net/
This is a repository of all of my Linux/Unix writings as well as useful tips and tricks for systems administration, engineering, and programming.
Showing posts with label CentOS. Show all posts
Showing posts with label CentOS. Show all posts
Friday, February 24, 2012
Wednesday, December 14, 2011
Make script compatible with chkconfig
To make an init script compatible with chkconfig (to autostart on next runlevel change), add the following header to your script within it's /etc/init.d/ file, for example, /etc/init.d/myscript
#!/bin/bash
#
# myscript init script to manage myserver
#
# chkconfig: 2345 90 35
# description: A server which does amazing things.
#
Now, add it with these commands:
/bin/chmod +x /etc/init.d/myscript
/sbin/chkconfig myscript --add
/sbin/chkconfig myscript on
/sbin/chkconfig myscript --list
myserver 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Within the chkconfig definition line, 2345 means the runlevels it will be started under, and 90 35 are the start and kill priorities, an integer between 0 and 99. In this example, it would be started as one of the last services, and killed (stopped) as one of the earlier processes.
#!/bin/bash
#
# myscript init script to manage myserver
#
# chkconfig: 2345 90 35
# description: A server which does amazing things.
#
Now, add it with these commands:
/bin/chmod +x /etc/init.d/myscript
/sbin/chkconfig myscript --add
/sbin/chkconfig myscript on
/sbin/chkconfig myscript --list
myserver 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Within the chkconfig definition line, 2345 means the runlevels it will be started under, and 90 35 are the start and kill priorities, an integer between 0 and 99. In this example, it would be started as one of the last services, and killed (stopped) as one of the earlier processes.
Tuesday, April 26, 2011
Install capistrano on RHEL or CentOS
Capistrano is great for automating system tasks. Here is how to install it on RPM-based systems:
# yum install ruby rubygems
# gem install mocha echoe rake capistrano
Please note that mocha, echoe are optional for tests, but I included them in these instructions.
# yum install ruby rubygems
# gem install mocha echoe rake capistrano
Please note that mocha, echoe are optional for tests, but I included them in these instructions.
Wednesday, December 30, 2009
Sample Linux interview questions
I have compiled some sample interview questions for use in testing a potential systems administrator or systems engineer. I have created most of them but have reused some of them from the recent interviews that I have had. It should be one way to separate candidates as well as prepare others for interviews.
Sample questions:
What is a way to find the current running kernel version level?
Various iterations of the uname command (uname -a or uname -r)
How do you update the system on Red Hat 4? Red Hat 5?
up2date -u (RHEL 4) and yum update (RHEL 5)
What is a way to see what service pack and version the Red Hat system is at? CentOS?
cat /etc/redhat-release (Same for both RHEL and CentOS)
What is a way to change a kernel parameter?
sysctl -w parameter=value (persistent)
or
echo 32768 > /proc/sys/fs/file-max (not reboot persistent)
or
change a kernel parameter in /boot/grub/menu.lst as such:
kernel /boot/vmlinuz-2.6.18-128.1.16.el5 ro root=LABEL=/ elevator=deadline (persistent)
or
change the parameter in /etc/sysctl.conf (persistent)
You have a 32 bit system but want to allow RHEL to be able to use more than 4GB of RAM. What kernel do you use to accomplish this task?
Install and boot into the PAE kernel.
Of these filesystems--XFS, EXT3, EXT4, reiserFS, what is the best for large files?
XFS
Of these filesystems--XFS, EXT3, EXT4, reiserFS, what is the best for small files?
reiserFS
Of these filesystems--XFS, EXT3, EXT4, reiserFS, which ones are supported as of RHEL 5.3?
EXT3 and EXT4 (technology preview)
What has Microsoft contributed to the Linux kernel (trivia)?
A kernel module which enabled better performance with its Hyper-V virtualization technology.
You have tried to install an RPM but it has failed because of broken dependencies. How do you override and force the installation anyway?
rpm -i myprogram.rpm --nodeps
How do you set the maximum interval between fsck checks on /dev/sda1 to be one week?
tune2fs -i 1w /dev/sda1
Define dom0 and domU.
dom0 (domain zero) is the server running the Xen, KVM, or QEMU hypervisor. domU (domain unprivileged) is a virtual machine within a Xen, KVM, or QEMU server.
By default, what is the first disk known as within a VMWare virtual machine?
/dev/sda
By default, what is the first disk known as within a Xen domU?
/dev/xvda
Hope this is helpful.
Sample questions:
What is a way to find the current running kernel version level?
Various iterations of the uname command (uname -a or uname -r)
How do you update the system on Red Hat 4? Red Hat 5?
up2date -u (RHEL 4) and yum update (RHEL 5)
What is a way to see what service pack and version the Red Hat system is at? CentOS?
cat /etc/redhat-release (Same for both RHEL and CentOS)
What is a way to change a kernel parameter?
sysctl -w parameter=value (persistent)
or
echo 32768 > /proc/sys/fs/file-max (not reboot persistent)
or
change a kernel parameter in /boot/grub/menu.lst as such:
kernel /boot/vmlinuz-2.6.18-128.1.16.el5 ro root=LABEL=/ elevator=deadline (persistent)
or
change the parameter in /etc/sysctl.conf (persistent)
You have a 32 bit system but want to allow RHEL to be able to use more than 4GB of RAM. What kernel do you use to accomplish this task?
Install and boot into the PAE kernel.
Of these filesystems--XFS, EXT3, EXT4, reiserFS, what is the best for large files?
XFS
Of these filesystems--XFS, EXT3, EXT4, reiserFS, what is the best for small files?
reiserFS
Of these filesystems--XFS, EXT3, EXT4, reiserFS, which ones are supported as of RHEL 5.3?
EXT3 and EXT4 (technology preview)
What has Microsoft contributed to the Linux kernel (trivia)?
A kernel module which enabled better performance with its Hyper-V virtualization technology.
You have tried to install an RPM but it has failed because of broken dependencies. How do you override and force the installation anyway?
rpm -i myprogram.rpm --nodeps
How do you set the maximum interval between fsck checks on /dev/sda1 to be one week?
tune2fs -i 1w /dev/sda1
Define dom0 and domU.
dom0 (domain zero) is the server running the Xen, KVM, or QEMU hypervisor. domU (domain unprivileged) is a virtual machine within a Xen, KVM, or QEMU server.
By default, what is the first disk known as within a VMWare virtual machine?
/dev/sda
By default, what is the first disk known as within a Xen domU?
/dev/xvda
Hope this is helpful.
Thursday, September 24, 2009
Process affinity
Here is how to bind a program to a CPU (process affinity):
Bind processes to a CPU core
An example would be:
taskset -pc 0,1,2 20509
to set processid #20509 to have affinity (bind) on Cpu0, Cpu1, and Cpu2. To bind it to a single core, use the command:
taskset -pc 0 20509
to bind it to Cpu0.
Bind processes to a CPU core
An example would be:
taskset -pc 0,1,2 20509
to set processid #20509 to have affinity (bind) on Cpu0, Cpu1, and Cpu2. To bind it to a single core, use the command:
taskset -pc 0 20509
to bind it to Cpu0.
Wednesday, October 8, 2008
Coraid documentation
I was able to do quite a bit of technical writing with Coraid. It is useful for those of you using AoE technology. I wrote all of the quickstart documentation here:
http://www.coraid.com/RESOURCES/Quickstart-Documentation
Also, I wrote the driver installation guides here:
http://www.coraid.com/SUPPORT/AoE-Drivers
http://www.coraid.com/RESOURCES/Quickstart-Documentation
Also, I wrote the driver installation guides here:
http://www.coraid.com/SUPPORT/AoE-Drivers
Subscribe to:
Posts (Atom)