<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SysAdmin.MD</title>
	<atom:link href="http://www.sysadmin.md/feed" rel="self" type="application/rss+xml" />
	<link>http://www.sysadmin.md</link>
	<description>Practical approach to all system administration tasks</description>
	<lastBuildDate>Tue, 05 Jan 2010 15:07:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Complete CentOS secure server setup</title>
		<link>http://www.sysadmin.md/complete-centos-secure-server-setup.html</link>
		<comments>http://www.sysadmin.md/complete-centos-secure-server-setup.html#comments</comments>
		<pubDate>Tue, 08 Dec 2009 10:05:21 +0000</pubDate>
		<dc:creator>Dmitri</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://www.sysadmin.md/?p=487</guid>
		<description><![CDATA[
This guide describes how to quick install a CentOS based webserver. It mainly focuses on performance and security.

Update the system
yum update
Remove unneeded software
Minimize the number of software that could possibly be exploited:
yum remove cups cups-libs irda-utils
Disable unnecessary services
This could be done by typing:
for service in \
atd \
anacron \
auditd \
cpuspeed \
kudzu \
mcstrans \
pcscd \
portmap; \
do chkconfig [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sysadmin.md/wp-content/uploads/complete-centos-secure-server-setup.png" target="_blank"><img class="alignnone size-medium wp-image-1874" title="complete-centos-secure-server-setup" src="http://www.sysadmin.md/wp-content/uploads/complete-centos-secure-server-setup-300x171.png" alt="complete-centos-secure-server-setup" width="300" height="171" /></a><br />
This guide describes how to quick install a CentOS based webserver. It mainly focuses on performance and security.<br />
<span id="more-487"></span></p>
<h4>Update the system</h4>
<pre><code>yum update</code></pre>
<h4>Remove unneeded software</h4>
<p>Minimize the number of software that could possibly be exploited:</p>
<pre><code>yum remove cups cups-libs irda-utils</code></pre>
<h4>Disable unnecessary services</h4>
<p>This could be done by typing:</p>
<pre><code>for service in \
<strong>atd</strong> \
<strong>anacron</strong> \
<strong>auditd</strong> \
<strong>cpuspeed</strong> \
<strong>kudzu</strong> \
<strong>mcstrans</strong> \
<strong>pcscd</strong> \
<strong>portmap</strong>; \
do chkconfig --level 0123456 $service off; done;</code></pre>
<p>As an alternative, you can use the setup tool.</p>
<h4>Install LAMP</h4>
<p>Use <a href="http://www.sysadmin.md/install-and-secure-lamp-on-centos.html" target="_blank">this guide</a> to install Apache, PHP, MySQL and phpMyAdmin</p>
<h4>Disable unneded stuff</h4>
<p>If you want you can disable IPv6 protocol, by editing file <strong>/etc/sysconfig/network</strong> and set:</p>
<pre><code>NETWORKING_IPV6=no</code></pre>
<p>After that, add the below code to <strong>/etc/modprobe.conf</strong> to disable ipv6 kernel module loading:</p>
<pre><code>alias ipv6 off
alias net-pf-10 off</code></pre>
<h4>Secure SSH</h4>
<p>To secure SSH access to the server follow the guide <a href="http://www.sysadmin.md/secure-existing-openssh-installation.html" target="_blank">Secure existing OpenSSH installation</a></p>
<h4>Secure temporary folders</h4>
<p>To prevent malicious scripts execution <a href="http://www.sysadmin.md/secure-temporary-folders-on-existing-unix-or-linux-systems.html"  target="_blank">secure temporary folders</a></p>
<h4>Install Firewall</h4>
<p>Finally, install <a href="http://www.sysadmin.md/server-hardening-with-configserver-security-firewall-csf.html"  target="_blank">ConfigServer security and Firewall</a></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.sysadmin.md/install-and-secure-lamp-on-centos.html" rel="bookmark" class="crp_title">Install and secure LAMP on CentOS</a></li><li><a href="http://www.sysadmin.md/scanning-server-for-malicious-tools-with-rkhunter.html" rel="bookmark" class="crp_title">Scanning server for malicious tools with rkhunter</a></li><li><a href="http://www.sysadmin.md/secure-existing-pureftpd-installation.html" rel="bookmark" class="crp_title">Secure existing PureFTPd installation</a></li><li><a href="http://www.sysadmin.md/secure-existing-proftpd-server-installation.html" rel="bookmark" class="crp_title">Secure existing ProFTPd server installation</a></li><li><a href="http://www.sysadmin.md/debian-lamp-nginx-installation-for-high-loaded-webservers.html" rel="bookmark" class="crp_title">Debian LAMP + nginx installation for high-loaded webservers</a></li><li><a href="http://www.sysadmin.md/install-java-on-centos-redhat-fedora.html" rel="bookmark" class="crp_title">Install Java on CentOS/Redhat/Fedora</a></li><li><a href="http://www.sysadmin.md/hardening-existing-linux-server-via-sysctl-parameters.html" rel="bookmark" class="crp_title">Hardening existing Linux server via sysctl parameters</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.sysadmin.md/complete-centos-secure-server-setup.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Secure existing PHP installation</title>
		<link>http://www.sysadmin.md/secure-existing-php-installation.html</link>
		<comments>http://www.sysadmin.md/secure-existing-php-installation.html#comments</comments>
		<pubDate>Mon, 30 Nov 2009 12:42:32 +0000</pubDate>
		<dc:creator>Dmitri</dc:creator>
				<category><![CDATA[Cheatsheets]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.sysadmin.md/?p=1861</guid>
		<description><![CDATA[It is impossible to achieve a high level of security for PHP applications in a production environment. However, with some security tips, you can avoid common mistakes and protect yourself from the most frequent attacks.

When using PHP in a production environment, you should have the following settings in php.ini:
safe_mode = Off
register_globals = Off
expose_php = Off

allow_url_fopen [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_1862" class="wp-caption alignnone" style="width: 310px"><a href="http://www.sysadmin.md/wp-content/uploads/secure_php.png" target="_blank"><img class="size-medium wp-image-1862" title="secure_php" src="http://www.sysadmin.md/wp-content/uploads/secure_php-300x171.png" alt="secure_php" width="300" height="171" /></a><p class="wp-caption-text">Secure PHP</p></div>
<p>It is impossible to achieve a high level of security for PHP applications in a production environment. However, with some security tips, you can avoid common mistakes and protect yourself from the most frequent attacks.<br />
<span id="more-1861"></span><br />
When using PHP in a production environment, you should have the following settings in <strong>php.ini</strong>:</p>
<pre><code>safe_mode = Off
register_globals = Off
expose_php = Off

allow_url_fopen = Off
allow_url_include = Off

log_errors = On
display_errors = Off
error_log = /var/log/phperror.log

memory_limit = 32M
post_max_size = 12M
upload_max_filesize = 8M
max_execution_time = 120
max_input_time = 60

enable_dl = Off
disable_functions="popen,exec,system,passthru,proc_open,shell_exec,show_source,phpinfo,eval"

session.use_only_cookies = 1</code></pre>
<p>All PHP errors will be stored in file <strong>/var/log/phperror.log</strong>. The following lines creates it and set the permissions:</p>
<pre><code>touch /var/log/phperror.log
chmod 666 /var/log/phperror.log</code></pre>
<p>Below is a description of directives used to secure PHP:</p>
<p><strong>safe_mode</strong><br />
It is primarily intended to provide file access limits to prevent users from accessing files that do no belong to them. This setting will be depreciated and should be avoided.</p>
<p><strong>register_globals</strong><br />
Disables automatic variable creation. This means that all PHP script must use the $_REQUEST, $_GET, or $_POST arrays to retrieve user-provided data. This directive is responsible for many security issues in web applications because it allowed attackers to freely manipulate global variables.</p>
<p><strong>expose_php</strong><br />
Hide PHP Version in Apache from remote users requests. Obviously there is no reason to let end users know about the server&#039;s PHP version.</p>
<p><strong>allow_url_fopen</strong><br />
This directive allows to reference remote resources as if they are local files. It is recommended to leave it disabled unless your application requires it.</p>
<p><strong>allow_url_include</strong><br />
This directive allows to include/require remote resources as if they are local files. As above directive, it is recommended to leave it disabled.</p>
<p><strong>log_errors</strong><br />
When enabled, <strong>log_errors</strong> instructs PHP to log all errors to the file indicated by the <strong>error_log</strong> directive.</p>
<p><strong>display_errors</strong><br />
PHP error messages display should be disabled on production servers to avoid information leaks about your system environment from badly written scripts.</p>
<p><strong>error_log</strong><br />
All PHP errors will be stored in file <strong>/var/log/phperror.log</strong>. The two above lines creates that file</p>
<p><strong>memory_limit</strong><br />
To prevent poorly written scripts from consuming all of the available memory, this directive can be used to indicate a maximum amount of memory consumed by a script.</p>
<p><strong>post_max_size</strong><br />
Controls the size of HTTP form submissions. You may tweak the values to suit your needs.</p>
<p><strong>upload_max_filesize</strong><br />
Maximum allowed size for uploaded files</p>
<p><strong>max_execution_time</strong><br />
Maximum execution time of each script. You may tweak the values to suit your need.</p>
<p><strong>max_input_time</strong><br />
Maximum amount of time each script may spend parsing request data.</p>
<p><strong>enable_dl</strong><br />
This directive is used to enable or disable the <strong>dl()</strong> function that allows runtime loading of PHP extensions. It makes possible to bypass some restrictions, so it is recommended to be disabled unless your application requires it.</p>
<p><strong>disable_functions</strong><br />
Directive allows to disable several security-sensitive functions. Previously, this necessitated hand-editing the C code from which PHP was made. For functions reference you can use <strong><a href="http://php.net/quickref.php">this list</a></strong></p>
<p><strong>session.use_only_cookies</strong><br />
Reduce the risk of session fixation by only allowing session IDs to be passed as cookies. In other words enabling this setting prevents attacks involved passing session ids in URLs.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.sysadmin.md/secure-existing-pureftpd-installation.html" rel="bookmark" class="crp_title">Secure existing PureFTPd installation</a></li><li><a href="http://www.sysadmin.md/secure-existing-proftpd-server-installation.html" rel="bookmark" class="crp_title">Secure existing ProFTPd server installation</a></li><li><a href="http://www.sysadmin.md/hardening-existing-linux-server-via-sysctl-parameters.html" rel="bookmark" class="crp_title">Hardening existing Linux server via sysctl parameters</a></li><li><a href="http://www.sysadmin.md/deny-media-file-storing-in-a-samba-share-through-a-name-filter.html" rel="bookmark" class="crp_title">Deny media file storing in a Samba share through a name filter</a></li><li><a href="http://www.sysadmin.md/denying-access-to-files-with-specific-extensions-in-apache.html" rel="bookmark" class="crp_title">Denying access to files with specific extensions in Apache</a></li><li><a href="http://www.sysadmin.md/install-and-secure-lamp-on-centos.html" rel="bookmark" class="crp_title">Install and secure LAMP on CentOS</a></li><li><a href="http://www.sysadmin.md/complete-centos-secure-server-setup.html" rel="bookmark" class="crp_title">Complete CentOS secure server setup</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.sysadmin.md/secure-existing-php-installation.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Package management cheatsheet</title>
		<link>http://www.sysadmin.md/package-management-cheatsheet.html</link>
		<comments>http://www.sysadmin.md/package-management-cheatsheet.html#comments</comments>
		<pubDate>Thu, 26 Nov 2009 10:12:28 +0000</pubDate>
		<dc:creator>Dmitri</dc:creator>
				<category><![CDATA[Cheatsheets]]></category>
		<category><![CDATA[management]]></category>
		<category><![CDATA[package]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://www.sysadmin.md/?p=1819</guid>
		<description><![CDATA[
In the servers world, software packages came in a variety of formats and could be installed in different ways. This cheat-sheet collects day by day operations with software performed by typical System Administrator on servers what runs Linux and BSD.

Basic operations
Inludes install, upgrade, and removal options.
Install
RPM based
rpm -ivh package-name.rpm
yum install package-name
zypper install package-name
DEB based
dpkg -i [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sysadmin.md/wp-content/uploads/packages_list.png" target="_blank"><img class="alignnone size-medium wp-image-1853" title="packages_list" src="http://www.sysadmin.md/wp-content/uploads/packages_list-300x171.png" alt="packages_list" width="300" height="171" /></a><br />
In the servers world, software packages came in a variety of formats and could be installed in different ways. This cheat-sheet collects day by day operations with software performed by typical System Administrator on servers what runs Linux and BSD.<br />
<span id="more-1819"></span></p>
<h3>Basic operations</h3>
<p>Inludes install, upgrade, and removal options.</p>
<h4>Install</h4>
<h5>RPM based</h5>
<pre><code>rpm -ivh <strong>package-name.rpm</strong>
yum install <strong>package-name</strong>
zypper install <strong>package-name</strong></code></pre>
<h5>DEB based</h5>
<pre><code>dpkg -i <strong>package-name.deb</strong>
apt-get install <strong>package-name</strong>
aptitude install <strong>package-name</strong></code></pre>
<h5>Gentoo based</h5>
<pre><code>emerge -av <strong>ebuild</strong></code></pre>
<h5>FreeBSD based</h5>
<pre><code>cd /usr/ports/<strong>package-name</strong> &amp;&amp; make install clean
pkg_add -r <strong>package-name</strong></code></pre>
<h4>Update</h4>
<h5>RPM based</h5>
<pre><code>rpm -Uvh <strong>package-name.rpm</strong>
yum update <strong>package-name</strong>
zypper up <strong>package-name</strong></code></pre>
<h5>DEB based</h5>
<pre><code>apt-get install <strong>package-name</strong>
aptitude install <strong>package-name</strong></code></pre>
<h5>Gentoo based</h5>
<pre><code>emerge -uDv <strong>package-name</strong></code></pre>
<h5>FreeBSD based</h5>
<pre><code>portmanager <strong>port-name</strong> -l -u -f</code></pre>
<h4>Remove</h4>
<h5>RPM based</h5>
<pre><code>rpm -e <strong>package-name.rpm</strong>
yum remove <strong>package-name</strong>
zypper remove <strong>package-name</strong></code></pre>
<h5>DEB based</h5>
<pre><code>dpkg -r <strong>package-name.deb</strong>
apt-get remove <strong>package-name</strong>
aptitude remove <strong>package-name</strong></code></pre>
<h5>Gentoo based</h5>
<pre><code>emerge -Cav <strong>ebuild</strong></code></pre>
<h5>FreeBSD based</h5>
<pre><code>pkg_delete <strong>package-name</strong>-<strong>version</strong></code></pre>
<h4>Search for a package</h4>
<h5>RPM based</h5>
<pre><code>yum search <strong>keyword</strong>
zypper se <strong>keyword</strong></code></pre>
<h5>DEB based</h5>
<pre><code>apt-cache search <strong>keyword</strong>
dpkg -C</code></pre>
<h5>Gentoo based</h5>
<pre><code>emerge -s <strong>keyword</strong>
emerge -S <strong>keyword</strong></code></pre>
<h5>FreeBSD based</h5>
<pre><code>whereis <strong>package-name</strong>
cd /usr/ports; make search name=<strong>package-name</strong>
find /usr/ports -name <strong>package-name</strong>
pkg_info -W <strong>package-name</strong></code></pre>
<h4>List contents of package</h4>
<h5>RPM based</h5>
<pre><code>rpm -qvl <strong>package-name.rpm</strong></code></pre>
<h5>DEB based</h5>
<pre><code>dpkg -c <strong>package-name.deb</strong></code></pre>
<h5>Gentoo based</h5>
<pre><code>qlist <strong>package-name.deb</strong></code></pre>
<h5>FreeBSD based</h5>
<pre><code>pkg_info -L <strong>package_name</strong></code></pre>
<h4>List all installed packages</h4>
<h5>RPM based</h5>
<pre><code>rpm -qvia
yum list available</code></pre>
<h5>DEB based</h5>
<pre><code>dpkg -l</code></pre>
<h5>Gentoo based</h5>
<pre><code>qpkg -I</code></pre>
<h5>FreeBSD based</h5>
<pre><code>pkg_info
pkg_info -a</code></pre>
<h4>Print information about a package</h4>
<h5>RPM based</h5>
<pre><code>rpm -qpi <strong>package-name.rpm</strong>
zypper info <strong>package-name</strong></code></pre>
<h5>DEB based</h5>
<pre><code>dpkg -I <strong>package-name.deb</strong>
dpkg -p <strong>package-name</strong></code></pre>
<h5>Gentoo based</h5>
<pre><code>emerge -pv <strong>ebuild</strong></code></pre>
<h5>FreeBSD based</h5>
<pre><code>pkg_info | grep <strong>package-name</strong></code></pre>
<h4>Integrity check</h4>
<h5>RPM based</h5>
<pre><code>rpm -Va
rpm -Vp <strong>package-name.rpm</strong></code></pre>
<h5>DEB based</h5>
<pre><code>debsums -a</code></pre>
<h5>Gentoo based</h5>
<pre><code>qcheck <strong>package_name</strong></code></pre>
<h4>Determine to which package a file belongs</h4>
<h5>RPM based</h5>
<pre><code>rpm -qf <strong>/path/to/file</strong></code></pre>
<h5>DEB based</h5>
<pre><code>dpkg -S <strong>/path/to/file</strong></code></pre>
<h5>Gentoo based</h5>
<pre><code>qpkg -f <strong>/path/to/file</strong>
qfile <strong>/path/to/file</strong></code></pre>
<h5>FreeBSD based</h5>
<pre><code>pkg_info -W <strong>/path/to/file</strong></code></pre>
<h4>Update packages tree</h4>
<h5>RPM based</h5>
<pre><code>yum check-update</code></pre>
<h5>DEB based</h5>
<pre><code>apt-get update
aptitude update</code></pre>
<h5>Gentoo based</h5>
<pre><code>emerge --sync</code></pre>
<h5>FreeBSD based</h5>
<pre><code>cvsup ports-supfile
portsnap fetch extract</code></pre>
<h4>Update all installed packages and userland</h4>
<h5>RPM based</h5>
<pre><code>yum update</code></pre>
<h5>DEB based</h5>
<pre><code>apt-get update &amp;&amp; apt-get upgrade</code></pre>
<h5>Gentoo based</h5>
<pre><code>emerge -eav world</code></pre>
<h5>FreeBSD based</h5>
<pre><code>portmaster -ai
portmanager -u
portupgrade -a
freebsd-update upgrade</code></pre>
<h4>List outdated packages</h4>
<h5>RPM based</h5>
<pre><code>yum list updates</code></pre>
<h5>DEB based</h5>
<pre><code>apt-get upgrade --just-print
apt-get upgrade -u
apt-show-versions -u</code></pre>
<h5>Gentoo based</h5>
<pre><code>emerge -eapv world</code></pre>
<h5>FreeBSD based</h5>
<pre><code>pkg_version -vIL=</code></pre>
<h4>Show package dependencies</h4>
<h5>RPM based</h5>
<pre><code>rpm -qpR <strong>package-name.rpm</strong>
yum deplist <strong>package-name</strong></code></pre>
<h5>DEB based</h5>
<pre><code>apt-cache depends <strong>package-name</strong>
apt-rdepends -d <strong>package-name</strong></code></pre>
<h5>Gentoo based</h5>
<pre><code>emerge -tp <strong>ebuild</strong>
equery depends <strong>ebuild</strong></code></pre>
<h5>FreeBSD based</h5>
<pre><code>pkg_info -L <strong>package_name</strong></code></pre>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.sysadmin.md/verbose-gentoo-linux-installation.html" rel="bookmark" class="crp_title">Verbose Gentoo Linux installation</a></li><li><a href="http://www.sysadmin.md/web-interfaces-for-bind-management.html" rel="bookmark" class="crp_title">Web interfaces for BIND management</a></li><li><a href="http://www.sysadmin.md/monitoring-linux-and-windows-hosts-with-snmp-and-cacti.html" rel="bookmark" class="crp_title">Monitoring Linux and Windows hosts with SNMP and Cacti</a></li><li><a href="http://www.sysadmin.md/opensource-browser-based-clients-for-email-hosting.html" rel="bookmark" class="crp_title">Opensource browser based clients for email hosting</a></li><li><a href="http://www.sysadmin.md/smart-way-to-show-apache-loaded-modules-from-shell.html" rel="bookmark" class="crp_title">Smart way to show Apache loaded modules from shell</a></li><li><a href="http://www.sysadmin.md/gentoo-logging-the-boot-messages.html" rel="bookmark" class="crp_title">Logging the Gentoo boot messages</a></li><li><a href="http://www.sysadmin.md/opensource-support-helpdesk-ticket-systems-for-web-based-businesses.html" rel="bookmark" class="crp_title">Opensource support/helpdesk/ticket systems for web-based businesses</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.sysadmin.md/package-management-cheatsheet.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>PS Cheatsheet</title>
		<link>http://www.sysadmin.md/ps-cheatsheet.html</link>
		<comments>http://www.sysadmin.md/ps-cheatsheet.html#comments</comments>
		<pubDate>Mon, 23 Nov 2009 09:43:44 +0000</pubDate>
		<dc:creator>Dmitri</dc:creator>
				<category><![CDATA[Cheatsheets]]></category>
		<category><![CDATA[ps]]></category>

		<guid isPermaLink="false">http://www.sysadmin.md/?p=1812</guid>
		<description><![CDATA[
The ps stands for process status and it is a handy tool used to retrieve the information about currently running processes on Linux or BSD systems. This cheatsheet collets the most useful ps invocations.

Show all processes
ps aux
Show all processes including commandline arguments
ps -AFl
Show all processes with threads in tree mode
ps -AlFH
Show processes in a hierarchy
ps [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sysadmin.md/wp-content/uploads/ps.png" target="_blank"><img class="alignnone size-medium wp-image-1813" title="ps" src="http://www.sysadmin.md/wp-content/uploads/ps-300x171.png" alt="ps" width="300" height="171" /></a><br />
The <strong>ps</strong> stands for process status and it is a handy tool used to retrieve the information about currently running processes on Linux or BSD systems. This cheatsheet collets the most useful <strong>ps</strong> invocations.<br />
<span id="more-1812"></span></p>
<p>Show all processes</p>
<pre><code>ps aux</code></pre>
<p>Show all processes including commandline arguments</p>
<pre><code>ps -AFl</code></pre>
<p>Show all processes with threads in tree mode</p>
<pre><code>ps -AlFH</code></pre>
<p>Show processes in a hierarchy</p>
<pre><code>ps -e -o pid,args --forest</code></pre>
<p>Show list of processes owned by a specific user</p>
<pre><code>ps -U <strong>user</strong> -u <strong>user</strong> u</code></pre>
<p>Show information for a particular process</p>
<pre><code>ps -p <strong>pid</strong>
ps uax | grep <strong>process_name</strong></code></pre>
<p>Show all threads for a particular process by id</p>
<pre><code>ps -p <strong>pid</strong> -L -o pid,tid,pcpu,state,comm</code></pre>
<p>Get top 5 processes by CPU usage</p>
<pre><code>ps -e -o pcpu,cpu,nice,state,cputime,args --sort pcpu | sed '/^ 0.0 /d'| tac |head -5
ps auxf | sort -nr -k 3 | head -5</code></pre>
<p>Get top 5 processes by memory usage</p>
<pre><code>ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS| tac | head -5
ps auxf | sort -nr -k 4 | head -5</code></pre>
<p>Get security info</p>
<pre><code>ps -eo euser,ruser,suser,fuser,f,comm,label</code></pre>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.sysadmin.md/get-aggregate-cpu-usage-for-a-particular-process.html" rel="bookmark" class="crp_title">Get aggregate CPU usage for a particular process</a></li><li><a href="http://www.sysadmin.md/package-management-cheatsheet.html" rel="bookmark" class="crp_title">Package management cheatsheet</a></li><li><a href="http://www.sysadmin.md/several-ways-to-reset-mysql-root-password.html" rel="bookmark" class="crp_title">Several ways to reset MySQL root password</a></li><li><a href="http://www.sysadmin.md/smart-way-to-show-apache-loaded-modules-from-shell.html" rel="bookmark" class="crp_title">Smart way to show Apache loaded modules from shell</a></li><li><a href="http://www.sysadmin.md/my-screenrc.html" rel="bookmark" class="crp_title">My .screenrc</a></li><li><a href="http://www.sysadmin.md/secure-existing-proftpd-server-installation.html" rel="bookmark" class="crp_title">Secure existing ProFTPd server installation</a></li><li><a href="http://www.sysadmin.md/deploy-django-in-production-using-apache-nginx-and-mod-wsgi.html" rel="bookmark" class="crp_title">Deploy Django in production using apache, nginx and mod-wsgi</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.sysadmin.md/ps-cheatsheet.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install and secure LAMP on CentOS</title>
		<link>http://www.sysadmin.md/install-and-secure-lamp-on-centos.html</link>
		<comments>http://www.sysadmin.md/install-and-secure-lamp-on-centos.html#comments</comments>
		<pubDate>Tue, 10 Nov 2009 08:38:47 +0000</pubDate>
		<dc:creator>Dmitri</dc:creator>
				<category><![CDATA[Cheatsheets]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.sysadmin.md/?p=812</guid>
		<description><![CDATA[
Use YUM to retrieve and install the Apache HTTP server and additional components. After that, start the web-server and put it on startup:
yum install httpd httpd-devel
service httpd start
chkconfig httpd on
Next step is securing Apache. Edit the config /etc/httpd/conf/httpd.conf and set:
ServerSignature Off
ServerTokens Prod
ErrorDocument 500 "Internal error"
ErrorDocument 404 "Not found"

First line tells Apache to not display the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sysadmin.md/wp-content/uploads/centos-secure-lamp.png" target="_blank"><img class="alignnone size-medium wp-image-844" title="centos-secure-lamp" src="http://www.sysadmin.md/wp-content/uploads/centos-secure-lamp-300x171.png" alt="centos-secure-lamp" width="300" height="171" /></a></p>
<p>Use YUM to retrieve and install the Apache HTTP server and additional components. After that, start the web-server and put it on startup:</p>
<pre><code>yum install httpd httpd-devel
service httpd start
chkconfig httpd on</code></pre>
<p>Next step is securing Apache. Edit the config <strong>/etc/httpd/conf/httpd.conf</strong> and set:</p>
<pre><code>ServerSignature Off
ServerTokens Prod
ErrorDocument 500 "Internal error"
ErrorDocument 404 "Not found"
</code></pre>
<p>First line tells Apache to not display the server version on generated pages. The second one makes the web-server to return only &#034;Apache&#034; in the header response.<br />
<span id="more-812"></span><br />
Now you ready to Install the PHP module for Apache. The following lines download and install the common PHP with some modules:</p>
<pre><code>yum install php-common php-gd php-mcrypt php-pear php-pecl-memcache php-mhash \
php-mysql php-xml</code></pre>
<p>Next step is securing PHP. Open PHP config file <strong>/etc/php.ini</strong> and follow the guide <a href="http://www.sysadmin.md/secure-existing-php-installation.html" target="_blank"><strong>Secure existing PHP installation</strong></a><br />
Restart webserver to load PHP module:</p>
<pre><code>service httpd restart</code></pre>
<p>At this point Apache is ready to serve. The PHP could be tested. Create a file named <strong>/var/www/html/1.php</strong> with the following contents:</p>
<pre><code>&lt;?php
phpinfo();
?&gt;</code></pre>
<p>Then point your browser to <strong>http://x.x.x.x/1.php</strong> and check the output.</p>
<p>Next, install MySQL with required packages, start it and put the database server to startup:</p>
<pre><code>yum install mysql mysql-server mysql-devel
service mysqld start
chkconfig mysqld on</code></pre>
<p>Once MySQL is installed, invoke it:</p>
<pre><code>mysql</code></pre>
<p>And change MySQL root password:</p>
<pre><code>mysql&gt; USE mysql;
mysql&gt; UPDATE user SET Password=PASSWORD('pa$$w0rd') WHERE user='root';</code></pre>
<p>Next, drop test database:</p>
<pre><code>mysql&gt; drop database test;
mysql&gt; DELETE FROM user WHERE user = '';
mysql&gt; FLUSH PRIVILEGES;</code></pre>
<p>For security reasons it&#039;s often a good idea to have in section <strong>[mysqld]</strong> of MySQL config file <strong>/etc/my.cnf</strong> the values:</p>
<pre><code>bind-address=127.0.0.1
local-infile=0
skip-bdb
</code></pre>
<p>The first line make MySQL to listen for TCP/IP connections only locally on the loop-back interface. Next line prevents against unauthorized reading from local files. The last line disables support for <strong>BerkeleyDB</strong> as its support will cease soon.</p>
<p>It is time to restart MySQL to make changes to work:</p>
<pre><code>service mysqld restart</code></pre>
<p>Once LAMP is functional, phpMyAdmin can be installed:</p>
<pre><code>yum install phpmyadmin</code></pre>
<p>If you get the error &#034;<strong>No package phpmyadmin available</strong>&#034; <a href="http://fedoraproject.org/wiki/EPEL/FAQ" taget="_blank">enable EPEL repository</a><br />
Restart the Apache webserver to be able to acces phpMyAdmin:</p>
<pre><code>service httpd restart</code></pre>
<p>To test phpMyAdmin you should point your browser to <strong>http://x.x.x.x/phpmyadmin</strong></p>
<p><strong>Note</strong>: If you want to add a virtual host <strong>www.domain.tld</strong> to the Apache &#8211; follow the below steps.</p>
<p>First of all create directories and set correct permissions:</p>
<pre><code>mkdir -p /home/<strong>domain.tld</strong>/{public_html,logs}
chown -R apache:apache /home/<strong>domain.tld</strong></code></pre>
<p>Open Apache config <strong>/etc/httpd/conf/httpd.conf</strong> and alter <strong>NameVirtualHost</strong> directive:</p>
<pre><code>NameVirtualHost <strong>ip.address</strong>:80</code></pre>
<p>After that add the following <strong>VirtualHost</strong> container and paste it at the end of the config file:</p>
<pre><code>&lt;VirtualHost <strong>ip.address</strong>:80&gt;
        ServerAdmin webmaster@<strong>domain.tld</strong>
        ServerName <strong>www.domain.tld</strong>
        ServerAlias <strong>domain.tld</strong>

        DocumentRoot /home/domain.tld/public_html

        &lt;Directory /&gt;
                Options -Indexes FollowSymLinks
                AllowOverride None

                Order allow,deny
                allow from all
        &lt;/Directory&gt;

        ErrorLog /home/<strong>domain.tld</strong>/logs/<strong>domain.tld</strong>-error_log
        CustomLog /home/<strong>domain.tld</strong>/logs/<strong>domain.tld</strong>-access_log common
&lt;/VirtualHost&gt;</code></pre>
<p>Test if the config syntax is OK and restart Apache:</p>
<pre><code>httpd -t
httpd -D DUMP_VHOSTS
service httpd restart</code></pre>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.sysadmin.md/debian-lamp-nginx-installation-for-high-loaded-webservers.html" rel="bookmark" class="crp_title">Debian LAMP + nginx installation for high-loaded webservers</a></li><li><a href="http://www.sysadmin.md/deploy-django-in-production-using-apache-nginx-and-mod-wsgi.html" rel="bookmark" class="crp_title">Deploy Django in production using apache, nginx and mod-wsgi</a></li><li><a href="http://www.sysadmin.md/complete-centos-secure-server-setup.html" rel="bookmark" class="crp_title">Complete CentOS secure server setup</a></li><li><a href="http://www.sysadmin.md/several-ways-to-reset-mysql-root-password.html" rel="bookmark" class="crp_title">Several ways to reset MySQL root password</a></li><li><a href="http://www.sysadmin.md/monitoring-linux-and-windows-hosts-with-snmp-and-cacti.html" rel="bookmark" class="crp_title">Monitoring Linux and Windows hosts with SNMP and Cacti</a></li><li><a href="http://www.sysadmin.md/smart-way-to-show-apache-loaded-modules-from-shell.html" rel="bookmark" class="crp_title">Smart way to show Apache loaded modules from shell</a></li><li><a href="http://www.sysadmin.md/enabling-innodb-storage-engine-in-mysql.html" rel="bookmark" class="crp_title">Enabling InnoDB storage engine in MySQL</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.sysadmin.md/install-and-secure-lamp-on-centos.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
