More SSH security

Posted by: Chris  :  Category: Linux Tips

For added security, I modified the .bashrc profile for any users that may have shell access, and added the following, so that when the user logs in, it sends out an email, letting you know that someone has logged in.

echo ‘ALERT – Root Shell Access (YourserverName) on:’ `date` `who` | mail -s “Alert: Root Access from `who | cut -d”(” -f2 | cut -d”)” -f1`”

Of course, you need to modify  the (Yourservername) and part.

This little code gets added into the .bashrc file for the user you want to report. For example, if the user logging in was named tedsite, you would add this to:


I was getting an error though once I tried it:

-bash: mail: command not found

This was fixed easily on the Centos system, by running the following from the command line:

yum install mailx

If you wanted to apply this to the root account, you would edit this file:


A quick note, its best to use an email address that is not on your current server.

Adding a new user to your system

Posted by: Chris  :  Category: Linux Tips

If you need to add a new user to your systemm just run the following commands:

useradd username

That will create a new user, and a new group, for the ‘username’ that you placed in there.  Now, to change the password for that user, run this:

passwd username

The system will ask you to input the password for the ‘username’ you chose twice.  Thats it, make sure you read the article on ssh security on how to make your enviroment more secure.

SSH Security

Posted by: Chris  :  Category: Linux Tips

There are many things one can do to help keep your ssh access secure on a shared hosting enviroment.  Grab your client (putty links can be found on the software page), log in, and lets go!

  1. The first one, don’t allow it!  Pretty simple huh?  In a shared hosting environment, there are very few reasons why you should allow a user to have ssh.  If you do, make sure you inspect the script(s) they plan on running, and keep an eye on the logs. Read more…