We will show you how to add/tmp security in Plesk in this post.
First and foremost, a Centos7 server Terminal is required.
When hackers try to hack servers/systems using a hacking script, the servers are no longer secure. No one knows how to stop these hackers from installing these types of scripts on the system, allowing us all to protect ourselves from any type of attack.
We use /tmp security to stop hackers from being able to run any script on the server.
The security of /tmp is very difficult to break. Many types of attack flood hacks/rootkits using PHP injecting may be prevented using this method.
Steps To Follow-
- Make a 2000MB or 1000MB /tmp partition on your hard drive.
Use this command for 2000Mb.
# dd if=/dev/zero of=/var/tmpMount bs=1024 count=2000000Use this command to transfer 1000MB.
#dd if=/dev/zero of=/var/tmpMount bs=1024 count=1000000
- The partition format utilizes the ext3 extension.
#mkfs.ext3 /var/tmpMountAfter you have run the command, press “Y.”
- Make a copy of the /tmp folder. We have a backup in case of a mistake, therefore we won’t have an issue.
#cp -R /tmp /tmpbak
- Now use the noexec option to mount the /tmp filesystem: noexec (script cannot be executed since it does not have the authorization to run) Allowing any hacking script to execute on that system is not permitted.
#mount -o loop,noexec,nosuid,rw /var/tmpMount /tmp
- Allow access to the /tmp folder. As a result, the /tmp folder has full access to all files and directories.
#chmod 1777 /tmp
- Remove the tmp backup folder and replace it with the /tmp folder.
#cp -R /tmpbak/* /tmp/
#rm -rf /tmpbak
- Now edit the /etc/fstab file to make the /tmp partition a permanent mount point. But first, make a backup of the /etc/fstab file because it is so important that if you make mistakes, your server will go down.
#vim /etcfstabAdd one more line here.
/var/tmpMount /tmp ext2 loop,noexec,nosuid,rw 0 0
Save this file with this command : wqMake careful to execute #mount -a after making any changes to /etc/fstab to ensure you didn’t make any mistakes. If mount -a runs without errors, it signifies that everything is set up correctly. If an error happens, it indicates that you have committed a mistake. Now, if you mount /tmp with the noexec option, any script you try to execute will be refused permission.
- Now create symbolic link for /tmp
#cp -rvf /var/tmp /var/tmpbak
#ln -s /tmp /var/tmp
#cp -R /var/tmpbak/* /tmp/
#rm -rf /var/tmpbak
- Now secure /dev/shm folder with noexec permission in /etc/fstab
#vim /etc/fstabAdd this line .
tmpfs /dev/shm tmpfs defaults,nosuid,noexec,rw 0 0
- Mount temporary /dev/shm
#mount -o remount /dev/shm
In this way, you can add /tmp security Centos7 was successfully installed.
Was this article useful to you then you’ll appreciate our assistance? Get a pre-secured, pre-optimized website with the Hosting difference today.