Archive for the ‘Shell’ Category

Server Monkey is looking for tutorial writers to join our staff. Interested applicants can send a quick introduction of themselves to apply@server-monkey.com

Verify Email Password With Telnet

posted by Mark Muyskens

The quickest way to verify an email password is by using telnet. The few steps below will show you how to do so;

telnet server-monkey.com 110

+OK Hello there.
USER tut@server-monkey.com
+OK Password required.
PASS testpassword
+OK logged in.
quit
+OK Bye-bye.
Connection closed by foreign host.



Download It;

wget http://downloads.ioncube.com/loader_download /ioncube_loaders_lin_x86.tar.gz
tar zfx ioncube_loaders_lin_x86.tar.gz
mv ioncube /usr/local

Find PHP.ini
php -i | grep php.ini

Edit your php.ini
pico /usr/local/lib/php.ini or nano /usr/local/lib/php.ini

Add Extension to PHP.ini
zend_extension=/usr/local/ioncube/ioncube_loader_lin_5.2.so

Restart Apache
service httpd restart

Check
php -v
PHP 5.2.10 (cli) (built: Aug 10 2009 05:47:14)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
with the ionCube PHP Loader v3.1.34, Copyright (c) 2002-2009, by ionCube Ltd.
with Suhosin v0.9.27, Copyright (c) 2007, by SektionEins GmbH


Exim Cheatsheet

posted by Mark Muyskens

While surfing the web, I discovered this great cheat sheet for troubleshoot mail issues in cPanel/DirectAdmin or any exim mail server.

You can check it out at;
http://bradthemad.org/tech/notes/exim_cheatsheet.php


Chattr, a more indepth look

posted by Thor Erik

Chatter is a utility you’d find on most Linux systems, it’s sole purpose is to change file attributes.

when you use Chattr you’ll probably use it in symbolic mode, this means you will be using +, – and =(plus, minus and equals) plus either of the attributes: A, S, a, c, D, d, I, i, j, s, T, t, u.

Symbols

+ adds a attribute

- removes a attribute

= causes the attribute to be the only

Attributes

a (small A) is append only, this only allows someone to add to a file.

c (small C) is compressed

d (small D) is no dump

i (small I) is immutable, meaning no delete for anyone, not even root

j (small J) is journaling

s (small S) is secure deletion, incase you want to remove a file completely with no way of recovery(except IBAS)

t (small T) is no tailing

u (small U) is undeleteable

A (capital A) is no atime updates

D (capital D) is synchronousdirectory updates

S (capital S) is synchronous updates

T (capital T) is top of directory hierarchy, useful for important files

Options

As with most commands you got options as well

chattr got most of the common ones:

-R, recursive

-V, verbose

-f, suppress most errors

-v, version

options go first of course

Common use

most of the time you won’t use all of these options, but some you will run into quite often would be

chattr +i/chattr =i to protect files from accidental deletion

chattr +T to make a important file top of the file listings

chattr +d to prevent dumping of a file

and in some rare cases
chattr +ad to only allowing appending and prevent backup using

dump

, this could be useful for log files etc. that you only want to be appended to and not backed up

Source: man chattr

Keep your clocks in sync

posted by Thor Erik

An issue I’ve come across a lot is that clocks don’t stay correct for a long time…

Now some smart heads thought up a way to fix that, it’s called NTP, Network Time Protocol.

Setting it up is easy:

on RHEL/Fedora/CentOS:

centos ~ # yum install ntp

on Debian and debian based distributions:

debian ~ # apt-get install ntp

(everything is root of course)

on debian you are done now, NTPD should be started, of course if you want to specify your own NTP server or NTP pool, you just edit /etc/ntp.conf

on RHEL it’s just a few more steps:

chkconfig ntpd on

ntpdate pool.ntp.org

/etc/init.d/ntpd start

and that should be it, please do know that if it’s a VPS forget about NTP, the system time is inherited from the host, unless you run it on a windows host(ex. Windows 2008 or in my debian server’s case, Windows 2008 R2 and using Hyper-V)

The error you get will be something like this:

ntpdate[18411]: step-systime: Operation not permitted

after trying to run ntpdate pool.ntp.org

On Windows it’s all a hell lot easier(in gui that is)

Right click on the clock and choose Adjust time and date

go to the Internet time tab.

then click the button saying Change settings.

make sure the checkbox is checked, and if you prefer a different ntp server, change it from time.microsoft.com (but it’s good as well, NTP takes latency into account when setting clock)

Windows does not support ntp pools, so please define a proper NTP server.


cPanel and DomainKeys

posted by Mark Muyskens

Lets face it. Sending mail to some domains such as yahoo and hotmail can become a pain in the ass. Installing DomainKeys can help with the delivery of mail.

Installation on a single domain;
/usr/local/cpanel/bin/domain_keys_installer user

Where user is the user’s cPanel username
If running this command gives you an error, then your more then likely not running the latest version of cPanel or you have not converted to maildir.

Installing on all domains;
for i in `ls /var/cpanel/users` ;do /usr/local/cpanel/bin/domain_keys_installer $i ;done

Bash script to parse all cPanel users and run the command.

Now, what about when you add new account;
Modify cPanel’s PostWWW script “/scripts/postwwwacct”
add;

my %OPTS = @ARGV;
my $user = $OPTS{’user’};
/usr/local/cpanel/bin/domain_keys_installer $user

Done.

More Info on DomainKeys; http://domainkeys.sourceforge.net/


What is Screen?

posted by Mark Muyskens

Screen allows you to run multiple full-screen pseudo-terminals from one real terminal, and lets you manipulate and save your screen input and output, copy and paste between windows.

First off, install screen;
yum install screen

Now, type;
screen

This will allow you to start a new screen. You can also use the -S option to name your screen like so;
screen -S 1

So your in a new screen now, awesome. Run your dang commands now.

To detach your screen while still leaving it running, you may push ctrl+a and then d.

To attach back to the screen;
screen -r

That’s about it. Screen For Dummies.

Other Commands;
Ctrl+a and then C; create a new screen
Ctrl+a and then N; switches between screens


Installing cPanel in 3 Quick Steps

posted by Mark Muyskens

Installing cPanel is as easy as…

1) cd /home
2) wget http://layer1.cpanel.net/latest
3) sh latest

and then wait while massive text scrolls your screen!



Have you ever wanted to VNC into your server and be able to access a GUI remotely? Well here’s a simple to follow tutorial that I have personally used several times!

Courtesy of WebHostingTalk.com;
http://www.webhostingtalk.com/showthread.php?t=589702



./ch_admin_passwd is Plesk’s utility to set the admin password.

Gets password from the environment variable PSA_PASSWORD
Password should be from 5 to 16 symbols and should not contain login name, whitespace, quotes or national characters”

[root@ServerMonkey bin]# export PSA_PASSWORD=’newpass’

[root@ServerMonkey bin]# echo $PSA_PASSWORD

newpass

[root@ServerMonkey bin]# ./ch_admin_passwd

[root@ServerMonkey bin]# export PSA_PASSWORD=

[root@ServerMonkey bin]# cat /etc/psa/.psa.shadow

newpass

[root@ServerMonkey bin]#