How many times have you written scripts and a had bad time with those having spaces? The remedy to this situation is your IFS value.
IFS or Internal Field Seperator holds the value which seperates the various entities. This can be file names, values read into a script by read etc. It is the character or characters designated as whitespace by the operating system.
The IFS is set to the newline and space character. The global variable $IFS stores the value. To view the exact value stored in IFS execute:
echo "$IFS" | cat -vTE ^I$ $
Running echo “$IFS” will not give you any visible output (after all, you are going to see a space and a newline). cat -vTE displays non printable characters , tabs as ^I and ends each line with a $ sign.
In a script which utilises filenames (with spaces), it is always preferable to change the IFS to include only the newline character opposed to the default space and newline character. Lets check out one such script which accepts filenames wih spaces. This scripts simply prints the file names in your current directory. (Remember to create some files in your currenct directory which has spaces. You may try the same script removing the lines with the IFS variable in reference to see the difference)
#!/bin/bash OIFS=$IFS # Original IFS IFS=$(echo -en "\n\b") # New IFS for fil in $(ls -1 $PWD); do echo $fil done IFS=$OIFS # Restore earlier IFS
IFS can also be used to read files with lines sepearated by a special character. For example in the /etc/passwd, to store the various entries like username, homedirectory etc.
The following script uses the while construct to determine the users who have the shell portion as /bin/false
#!/bin/bash
OIFS=$IFS
IFS=':'
while read username password userid groupid comments homedir shell_avail
do
if [[ $shell_avail == /bin/false ]]; then
echo "$username has no shell"
fi
done < /etc/passwd
IFS=$OIFS
In the above script each of the 7 portions of the /etc/passwd file is assigned to the 7 variables
username password userid groupid comments homedir shell_avail with the read command. The if portion in the script compares the seventh variable – shell_avail to /bin/false to determine the username and outputs it.
From now on you can use the IFS variable for all those files with spaces and extracting values separated by a special character.
Continue ReadingA rootkit is a collection of programs that enable an attacker to get the same privilage as the root user in a linux or unix system. The word is composed of two portions: ‘root’ – meaning the application will provide the highest access level of the root/administrator in the system and ‘kit’ – meaning it has a number of tools.
Attackers after getting access to a server, will install a rootkit to hide their identity and run desired scripts anywhere within the server. It makes the life of a hacker easy once installed. Rootkits are not easily detectable. Sometimes, if the rootkit is one of the latest ones without a diagnosis, the server will have to be rebuild from scratch.
A rootkit will have multiple applications for cracking the entire server, some of them are:
Server Access Applications (Back door application)
These applications will create a backdoor to log in to the hacked system without using the exploit again.
Log clearing Applications
These applications clear the logs of the events performed by the hacker or the applications used. They all the associated log files in the server.
Packet sniffing Applications
These applications monitor the data through the various interfaces in the server at particular ports.
Malicious Scripts
Many scripts will be installed like IRC bots, ddos daemons, spam servers, trojans, worms etc.
There are mainly two kinds of root kits. The application rootkit and the kernel rootkit.
Application rootkits
These rootkits mimic a particular application and will hide the attackers files/processes from being revealed by the original application. To illustrate, a rootkit ls application will perform all the task of a normal ls but will not display any of the files of the attacker. Other application rootkits will create backdoors for unauthorised access, packet sniffers etc which go undetected or are hidden by renaming. Application rootkits are the most common.
Kernel rootkits
Kernel rootkits modify the kernel and apply patches to the kernel and device drivers. They also hide the applications and files of the attacker. As antivirus and other applications run beneath the kernel, they are the most undetectable rootkits.
‘Prevention is better than cure’ – as this saying goes, it is always better to keep the system secure and updated when ever possible to stop these installations. There are some applications which help detect any known rootkits running in the system. One such is the chkrootkit.
chkrootkit is one of the popular rootkit detectors (an anti-rootkit) and it is know to detect common rootkits on unix/linux servers. chkrootkit relies on basic string processing techniques to determine the presence of rootkits. It scans specific sytem files and binaries targeted by rootkits for known signatures.
The following are the instructions to install chkrootkit version 0.49 in a server.
cd /usr/local/ wget ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.tar.gz wget ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.md5 md5sum -c chkrootkit.md5 # to check if the downloaded file is intact tar -xzf chkrootkit.tar.gz cd chkrootkit-0.49/ make sense ./chkrootkit
chkroootkit will check all the files and display the status of the files analysed. This information may be logged for future reference. For this a cron job may be setup to be run at least once a month.
Inserting an entry like the one below into the systems cron tasks (executed atleast once a month) will send the report of the chkrootkit vulnerabilities to the administrator conserned.
/usr/local/chkrootkit-0.49/chkrootkit | mail -s "chkrootkit report $(date +%d/%m/%y)" "admin@domain.com"Continue Reading
Before your read on our plans further and not to make you disappointed at a later stage, let me make it clear that the 50% off is only for the first 3 months of services with us and the rest of the month will be in range of 70%-90% of the normal rates.
Avail this hot offer, before July 20th. Please also note that all these plans include LiveChat support as well.
On all our plans – we meet 15 mins response time and 6 hours resolution time. We are so much confident on our quality delivery that any ticket which doesn’t meet this response times and the resolution times will get 100% refund. With the semi & dedicated support, if we fail to meet the response time and resolution time for any more than 10% of tickets you get free support for the next month or 100% refund (if you decide to leave us)
Dedicated Support Staff
SupportSages is now offering Level I, 8*6 dedicated staff, for just $249 per month for the first three months after which, it will be $399 per month. Hired personnel will be completely dedicated to the success of your firm.
Our Level 1 dedicated admin staff can,
Few words about our Level I staffs.
L2 techs is available at $499 per month for the first three months – $749 from the fourth
L3 engineers is available at $999 per month for the first three months – $1499 from the next
24/7 Support Team
Semi-dedicated Support Team – $750 for the first three months – $1200 from the fourth.
Dedicated Support Team – $2250 for the first three months – $3600 from the fourth.
Per Server Support – This rate is per month & recurring!
1 server – $59 per server per month
2 servers – $89 per server per month
3-5 servers – $79 per server per month
5-10 servers – $69 per server per month
10+ servers – $59 per server per month
1 server and 10+ servers cost the same for you!!! What kind of offer is this eh ??? We want a starter to succeed too.
If you just want LiveChat support as well, please add $30 per server on the above rates. Please note that LiveChat support option for 1 server will invite the extra rate of $50 instead.
Details of this offer
24/7 Live Chat for you, the server owner (at no extra charge)
24/7 transparent support for end user – We login to your helpdesk and do the tickets
24/7 Proactive Server Monitoring
24/7 Server Management
15 minutes guaranteed response time – Often a ticket is responded or resolved in 7 minutes time.
6 hours guaranteed resolution time – Often an issue is resolved in less than one hour time.
Installation of 3rd Party Software/Scripts
Level 1, 2 and 3 Support
We can provide Pre-Sales & Sales support too at this rate
Australian dictionary for Oz clientele and US dictionary for US clientele (if you understand what we mean)
NOW offer MANAGED VPSes for as low as $249 per VPS node
Through us, now you can!!! If you are someone who places quality of service over all, opt us. You will never regret the decision.
Maximum of 15 minutes response time and 6 hours resolution time – Best response times in the industry (delivered by a technical support firm). Average is far far below that – 5 mins response time and 45 mins resolution time.
Here is our VPS management offer details
Imagine you are accessing your Website WHM or cPanel or Webmail hosted (in your VPS) and what if you see this
How to solve this
Pre-Requisites : You should have Shell access (as root) to the Node server.
Mostly this happens due to inode issue. The inodes allocated to the server maybe full. inode is a data structure on a traditional Unix-style file system such as UFS. An inode stores basic information about a regular file, directory, or other file system object.
Steps
Say we are logged into the Node Server. There we are going to list all the Containers existing on the Hardware Node. By default, only running Containers are shown.
[root@linuxvps1 ~]# vzlist -a CTID NPROC STATUS IP_ADDR HOSTNAME 100 18 running 100.20.11.111 WEB.EXAMPLE.COM 101 63 running 100.20.12.203 - 102 169 running 100.20.92.182 server2.example.com 103 81 running 100.20.56.169 example.net 78965 236 running 100.20.77.204 server1.example.com
Assume your container is 103. So simply enter into 103 by this command
[root@linuxvps1 ~]# vzctl enter 103
Check if the inodes are full in the container
[root@linuxvps1 ~]# df -i
Most Probably it should display something like this :
Filesystem Inodes IUsed IFree IUse% Mounted on /dev/vzfs 200000 200000 0 100% / none 65536 95 65441 1% /dev
Bang ! The inodes on /dev/vzfs mounted on / are full. You’ve to go nowhere else to see why that error was delivered. A simple solution will work out, you’ve to increase the inode limit. You’ve two options, either through Shell or through the Node Control Panel (like Parallels Infrastructure Manager)
First we will go through Shell mode with this command :
$ vzctl set veid --diskinodes softlimit:hardlimit
Where ‘veid’ is the VPS ID
root@linuxvps1 ~]# vzctl set 103 --diskinodes 7680100:7680200
Second we are going for Node Control Panel. In the infrastructure, you will see your VPS with a ! sign. That indicates your VPS is having some sort of issue.
So you’ve seen the Alert. Next access the VPS, go to Resources tab. I’m sorry to tell you that I grabbed this screenshot after resolving the issue, but it will help you anyway
You should see the ‘Disk Inodes’ is full under ‘Disk Usage’ category (Here it is not !). Next Click Configure to settle this one
See the Highlighted part, the inodes should be limited to some size. Increase it or remove the check mark to make it unlimited. Make sure you save the changes. Now try again accessing cpanel/WHM/Webmail. It should load with out any issues.That makes a smile in your face, isn’t it ?