November 6, 2009 | Posted by
admin | Category: Linux Administration
How to secure /tmp and /dev/shm partitions?
It is highly recommended to mount /tmp and /dev/shm partitions in noexec,nosuid mode in order to prevent files been executed under those partitions. To mount /tmp and /dev/shm in noexec,nosuid more, edit the /etc/fstab file and
search for the word
"defaults"
in front of the 2 partitions and replace them with
rw,noexec,nosuid
The entry should look like the following:
tmpfs /dev/shm tmpfs rw,noexec,nosuid 0 0
and same for /tmp partition as well.
Save the /etc/fstab file. You now need to remount the partitions for the changes to take effect. Execute the following remount commands:
root@host [~]# mount -o remount /tmp
root@host [~]# mount -o remount /dev/shm
You can now check the mounted partitions using the command:
root@host [~]# mount
Related Links:
How to secure /tmp on a VPS?
Comments Off on Howto: Secure /tmp and /dev/shm partitions
November 4, 2009 | Posted by
admin | Category: Linux Administration
How to check the Linux Server Uptime?
There are different ways to check the uptime of the Linux server like using the “top” OR the “uptime” OR the “w” command. Following are some of them:
root@host [~]# top c
top – 15:50:20 up 2 days, 11:32, 1 user, load average: 0.00, 0.00, 0.00
root@host [~]# uptime
15:51:01 up 2 days, 11:33, 1 user, load average: 0.00, 0.00, 0.00
root@host [~]# w
15:51:07 up 2 days, 11:33, 1 user, load average: 0.00, 0.00, 0.00
Comments Off on Linux Server Uptime
October 24, 2009 | Posted by
admin | Category: Linux Administration
Problem: Not able to list more than 2000 files in a directory using Ftp.
Solution:
The pure-ftp by default limit maximum number of # files to be displayed to 2000.
So edit your pureftpd configuration file which is at /etc/pure-ftpd.conf and change the line
LimitRecursion 2000 8
to
LimitRecursion 5000 8
Save the file and restart the service.
service pure-ftpd restart
It will display 5000 files from a directory now.
Comments Off on PureFtp + Not able to list more than 2000 files
October 21, 2009 | Posted by
admin | Category: Linux Administration
Error Message:
/usr/bin/phpize: /tmp/tmpjMvBZg/package.x.x/build/shtool: /bin/sh: bad interpreter: Permission denied
If you receive the above error message while installing a package using “pecl”, it meant that the /tmp partition is mounted in “noexec” mode and that you do not have permissions to execute anything under /tmp partition.
Execute the “mount” command and you will see something like:
root@server [~]# mount
/dev/sdax on /tmp type ext3 (rw,noexec,nosuid)
To mount the /tmp partition in rw mode, execute:
root@server [~]# mount -o remount rw /tmp
Now, you can execute the “pecl” command to install the package you like. Once done, you can remount /tmp with noexec mode again:
root@server [~]# mount -o remount rw,noexec,nosuid /tmp
October 19, 2009 | Posted by
admin | Category: Linux Administration
Error Message:
[root@server ~]# locate filename
-bash: locate: command not found
You may receive the above error message while searching a file using locate command and the error indicates that the package “slocate” required for the locate command is not installed. To install the package, execute:
yum -y install slocate
You will now be able to use the locate command but before that, execute the command “updatedb” so that the locate database is updated.
Comments Off on -bash: locate: command not found