Community Forums
Connect with us on LinkedIn
  
+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Mar 2007
    Location
    UK
    Posts
    14

    Question tmp folder

    There is a folder called tmp at the root level on the cPanel website which I am now managing. Can all these historic files be deleted without upsetting anything?

  2. #2
    Member
    Join Date
    Aug 2006
    Posts
    42

    Default

    Hi,

    don't delete mysql.sock - all other Data can you delete.

    If you delte mysql.sock you need to restart the Mysql - if it don't work - restart the Server.

    Regards
    1a-Websolutions - Schweizer Qualitäts-Hosting mit Cpanel

  3. #3
    Member
    Join Date
    Mar 2007
    Posts
    12

    Default Securing /tmp Partition

    Hi,

    It would be worthwhile to give /tmp it's own partition and mount it using noexec- This would protect your system from MANY local and remote exploits of rootkits being run from your /tmp folder.

    What we are doing it creating a file that we will use to mount at /tmp. So log into SSH and SU to root so we may being!

    cd /dev

    dd if=/dev/zero of=tmpMnt bs=1024 count=100000

    Make an extended filesystem for our tmpMnt file

    /sbin/mke2fs /dev/tmpMnt

    Backup your /tmp dir- I had mysql.sock file that I needed to recreate the symbolic link for. Other programs may use it to store cache files or whatever.

    cd /

    cp -R /tmp /tmp_backup

    Mount the new /tmp filesystem with noexec

    mount -o loop,noexec,nosuid,rw /dev/tmpMnt /tmp

    chmod 1777 /tmp

    Copy everything back to new /tmp and remove backup

    cp -R /tmp_backup/* /tmp/

    rm -rf /tmp_backup

    Now we need to add this to fstab so it mounts automatically on reboots.

    vi /etc/fstab

    You should see something like this:

    /dev/hda3 / ext3 defaults,usrquota 1 1
    /dev/hda1 /boot ext3 defaults 1 2
    none /dev/pts devpts gid=5,mode=620 0 0
    none /proc proc defaults 0 0
    none /dev/shm tmpfs defaults 0 0
    /dev/hda2 swap swap defaults 0 0

    At the bottom add
    /dev/tmpMnt /tmp ext2 loop,noexec,nosuid,rw 0 0

    (Each space is a tab)
    Save it!

    Your done- /tmp is now mounted as noexec. You can sleep a little bit safer tonight. I created a hello world c++ and compiled it then moved it to /tmp. Upon trying to run it (even chmod +x'ed), it gives the following error:

    bash: ./a.out: Permission denied

    Thanks
    Shivin Vijai
    Jr. Systems Administrator

    shivinvijai@yahoo.com
    http://shivin.spaceforlinux.com

  4. #4
    Member
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    675

    Default

    shivinvijai - it would be nice if you mentioned you didn't write this and you copied and pasted the article from my site http://www.webhostgear.com/34.html

    Upload Guardian 2.0 - Sign up for our early beta
    ServerProgress - Server security, consulting and assistance

  5. #5
    cPanel Development cpanelkenneth's Avatar
    Join Date
    Apr 2006
    Posts
    3,788
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    /scripts/securetmp also creates a loopback file to mount noexec on /tmp

    It does that if /tmp is not already a partition (slice for FreeBSD)

    It usually runs in /etc/rc.local

  6. #6
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    7,894
    cPanel/Enkompass Access Level

    Root Administrator

    Thumbs up

    Quote Originally Posted by ramprage View Post
    shivinvijai - it would be nice if you mentioned you didn't write this and you copied and pasted the article from my site http://www.webhostgear.com/34.html

    Lots of great stuff there too.



    typo check


    So log into SSH and SU to root so we may being!
    Fav cPlinks this week: Blog - cPanel & WHM 11.32 we love it! | cPanel University study for it! | Attracta is coming! we want this!

Similar Threads & Tags
Similar threads

  1. New /tmp folder fails...
    By schoeps in forum cPanel Developers
    Replies: 1
    Last Post: 04-15-2008, 10:49 PM
  2. cpanel.tmp file in users /tmp folder
    By BPmedia-David in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 08-08-2007, 06:13 AM
  3. tmp/analog folder
    By mmk in forum New User Questions
    Replies: 1
    Last Post: 09-29-2006, 07:50 PM
  4. 'tmp' folder not creating
    By smallpacks in forum New User Questions
    Replies: 1
    Last Post: 08-04-2005, 11:35 AM
  5. /tmp folder....
    By tanfwc in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 07-21-2004, 08:35 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube