Common SSH Commands or Linux Shell Commands
ls : list files/directories in a directory, comparable to dir in windows/dos.
ls -al : shows all files (including ones that start with a period), directories, and details attributes for each file.
cd : change directory � � cd /usr/local/apache : go to /usr/local/apache/ directory
cd ~ : go to your home directory
cd - : go to the last directory you were in
cd .. : go up a directory cat : print file contents to the screen
cat filename.txt : cat the contents of filename.txt to your screen
chmod: changes file access permissions
The set of 3 go in this order from left to right:
USER - GROUP - EVERONE
How to mount drive in linux
How To Mount A Drive In Linux
Initially you wanna check the hard drives on your system
fdisk -l
so now you now whats being seen by the system
Command Line
mount /dev/partitionId /some/mounting/point
for example
mount /dev/sdb /backup
The mounting point path must already be created with proper permissions. So a more likely flow of commands would be below:
How to restart apache webserver Under Linux
Every time you make config changes to Apache, you have to restart the server. If you’re suffering the death of a thousand clicks trying to use a GUI to do this simple task, here’s a tip that’ll get it done quick and easy.
If you’ re like me (read: not a seasoned sysadmin) you’ ve probably taken the GUI root to restarting Apache. Whether weaving through the RedHat Control Panel or by simply closing your Windows DOS window, you may have thought “There’ s got to be a better way!”
Well, there is.
Restart:
/etc/rc.d/init.d/httpd restart
Start:
How to downgrade MySQL5 to MySQL4.1 in cPanel
For whatever reason , some people still want to run the old version of MySQL4.1 in there new cPanel servers, which seems a little issue , as the default database version in new cPanel server installs is MySQL5.
Here are the simple steps to downgrade the database (this should only be done on a new server without any account on it yet)
Log into SSH as root and modify the cpanel.config
Repair Internal Server Error Cpanel account
Posted by Editor in Command, Server Security, cpanel on April 25th, 2009
If you have cpanel server, and have phpsuexec or suphp installed and you get “Internal Server Error” message while accessing account on your server, you must see permission in users directory. If PHP runs with phpsuexec or suphp, all files under accounts must have correct ownership. If you see that your directory/account ownership still nobody, you must change it manually or you can use cpanel included scripts to repair permission for all accounts.
How to Secure your VPS /tmp folder
Posted by Editor in Command, Server Security on April 25th, 2009
tmp can be secured to be noexec in 1 minute, no reboot required. Nothing can execute there - /var/tmp remains a risk - unless that is mounted separately also:
/dev/VolGroup00/LogVol02 /tmp ext3 defaults,nosuid,noexec 1 2
Single cPanel Account Backup via SSH
If you need to backup a single cPanel account, and don’t want to do it through the web interface of cPanel you can do it through SSH. There is a script in the /scripts directory on cPanel webservers called “pkgacct” 1. Login to your server as root via SSH.
2. Type: cd /scripts
3. Type: ./pkgacct username
(replace username with the acount username you wish to backup)
How to install Rkhunter
Installing:
wget http://garr.dl.sourceforge.net/sourceforge/rkhunter/rkhunter-1.3.4.tar.gz
tar -zxvf rkhunter-1.3.4.tar.gz
cd rkhunter-1.3.4
./installer.sh
Some free Cron job services
Cronjob is a time-based scheduling service in Unix-like computer OS. Cronjob are useful for periodic tasks like updating content, sending emails, refreshing database and more commands that need to run periodically.
Here’s some free cron jobs services:
- SetCronJob - http://www.setcronjob.com/
You can create up to 10 cron jobs, running up to every five minutes. When the time matches your criteria, SetCronJob will call the URL given (script in PHP, ASP, JSP, etc, backup your files, databases, clear temporary files, send newsletters, etc).
Find and delete nobody files
The below command will search all user document root for files owned by nobody and display them on the screen. This is one of the most likely location of uploaded nobody files but its possible for files to be outside this directory. You’ll need to adjust the scope of the command where necessary.
find /home/*/public_html -user nobody -print
The below command will search and delete all files in the users document root that are owned by the nobody user. It’s recommended you just do a find first, then if it’s clear run the below command:
find /home/*/public_html -user nobody -print | xargs rm
To delete folders owned by nobody user too, use:
find /home/user/public_html -user nobody -print | xargs rm -Rf