Jump to content
Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble


  • Content Count

  • Joined

  • Last visited

  • Feedback


Community Reputation

23 Excellent

About NukeNick

  • Rank

Personal Information

  • Website

Recent Profile Visitors

3,560 profile views
  1. Σε βήματα, για να αλλάξουμε το CTID ενός VPS που σηκώνεται με openVZ (καλό για να κλείνουν τα "κενά" στην αυτόματη αρίθμηση) sourcecid=100 targetcid=101 vzctl chkpnt ${sourcecid} --dumpfile /tmp/openvz-renumber-dump.${sourcecid} mv /etc/vz/conf/${sourcecid}.conf /etc/vz/conf/${targetcid}.conf mv /vz/private/${sourcecid} /vz/private/${targetcid} mv /vz/root/${sourcecid} /vz/root/${targetcid} vzctl restore ${targetcid} --dumpfile /tmp/openvz-renumber-dump.${sourcecid}
  2. PROBLEM Στην τελευταία αναβάθμιση cPanel, στο δωρεάν plugin του Nginx , παρατηρείται το παρακάτω error: SOLUTION Ανοίγουμε το αρχείο /usr/local/cpanel/whostmgr/docroot/cgi/addon_nginx.cgi και κάνουμε comment τη γραμμή use whmlib;
  3. Q. How do I Move or migrate user accounts to from old Linux server a new Cent OS Linux server including mails? This new system a fresh installation. A. You can migrate users from old Linux server to new Linux sever with standard commands such as tar, awk, scp and others. This is also useful if you are using old Linux distribution such as Redhat 9 or Debian 2.x. Following files/dirs are required for traditional Linux user management: * /etc/passwd – contains various pieces of information for each user account * /etc/shadow – contains the encrypted password information for user’s accounts and optional the password aging information. * /etc/group – defines the groups to which users belong * /etc/gshadow – group shadow file (contains the encrypted password for group) * /var/spool/mail – Generally user emails are stored here. * /home – All Users data is stored here. You need to backup all of the above files and directories from old server to new Linux server. Commands to type on old Linux system First create a tar ball of old uses (old Linux system). Create a directory: # mkdir /root/move/ Setup UID filter limit: # export UGIDLIMIT=500 Now copy /etc/passwd accounts to /root/move/passwd.mig using awk to filter out system account (i.e. only copy user accounts) # awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/passwd > /root/move/passwd.mig Copy /etc/group file: # awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/group > /root/move/group.mig Copy /etc/shadow file: # awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534) {print $1}' /etc/passwd | tee - |egrep -f - /etc/shadow > /root/move/shadow.mig Copy /etc/gshadow (rarely used): # cp /etc/gshadow /root/move/gshadow.mig Make a backup of /home and /var/spool/mail dirs: # tar -zcvpf /root/move/home.tar.gz /home # tar -zcvpf /root/move/mail.tar.gz /var/spool/mail Where, Users that are added to the Linux system always start with UID and GID values of as specified by Linux distribution or set by admin. Limits according to different Linux distro: RHEL/CentOS/Fedora Core : Default is 500 and upper limit is 65534 (/etc/libuser.conf). Debian and Ubuntu Linux : Default is 1000 and upper limit is 29999 (/etc/adduser.conf). You should never ever create any new system user accounts on the newly installed Cent OS Linux. So above awk command filter out UID according to Linux distro. export UGIDLIMIT=500 – setup UID start limit for normal user account. Set this value as per your Linux distro. awk -v LIMIT=$UGIDLIMIT -F: ‘($3>=LIMIT) && ($3!=65534)’ /etc/passwd > /root/move/passwd.mig – You need to pass UGIDLIMIT variable to awk using -v option (it assigns value of shell variable UGIDLIMIT to awk program variable LIMIT). Option -F: sets the field separator to : . Finally awk read each line from /etc/passwd, filter out system accounts and generates new file /root/move/passwd.mig. Same logic is applies to rest of awk command. tar -zcvpf /root/move/home.tar.gz /home – Make a backup of users /home dir tar -zcvpf /root/move/mail.tar.gz /var/spool/mail – Make a backup of users mail dir Use scp or usb pen or tape to copy /root/move to a new Linux system. # scp -r /root/move/* user@new.linuxserver.com:/path/to/location Commands to type on new Linux system First, make a backup of current users and passwords: # mkdir /root/newsusers.bak # cp /etc/passwd /etc/shadow /etc/group /etc/gshadow /root/newsusers.bak Now restore passwd and other files in /etc/ # cd /path/to/location # cat passwd.mig >> /etc/passwd # cat group.mig >> /etc/group # cat shadow.mig >> /etc/shadow # /bin/cp gshadow.mig /etc/gshadow Please note that you must use >> (append) and not > (create) shell redirection. Now copy and extract home.tar.gz to new server /home # cd / # tar -zxvf /path/to/location/home.tar.gz Now copy and extract mail.tar.gz (Mails) to new server /var/spool/mail # cd / # tar -zxvf /path/to/location/mail.tar.gz Now reboot system; when the Linux comes back, your user accounts will work as they did before on old system: # reboot Please note that if you are new to Linux perform above commands in a sandbox environment. Above technique can be used to UNIX to UNIX OR UNIX to Linux account migration. You need to make couple of changes but overall the concept remains the same.
  4. To check all SQL databases, use the following commands: Check repair and optimize all SQL databases mysqlcheck --all-databases -r #repair mysqlcheck --all-databases -a #analyze mysqlcheck --all-databases -o #optimize Useful! You can copy this code in a new .sh file and use it as a script, or even automate the optimisation using Cron
  5. To see the total number of mails in the mailing queue: Exim count mail in queue exim -bpc Use the following to see which scripts are sending out mail (helps keeping an eye on mailsenders and possible malware): List the scripts sending mails and count for each one grep cwd /var/log/exim_mainlog | grep -v /var/spool | awk -F"cwd=" '{print $2}' | awk '{print $1}' | sort | uniq -c | sort -n To clear the mailing queue: Exim clear the mail queue exim -bp | awk '/^ *[0-9]+[mhd]/{print "exim -Mrm " $3}' | bash Or even better, a “cleaner” approach: exim -bp | exiqgrep -i | xargs exim -Mrm To clear the Exim mailing statistics: Clear Exim Statistics cd /var/log rm -fr exim*.1 rm -fr exim*.2 rm -fr exim*.3 rm -fr exim*.4 rm -fr exim_mainlog ; touch exim_mainlog ; chown mailnull.mail exim_mainlog rm -fr exim_paniclog ; touch exim_paniclog ; chown mailnull.mail exim_paniclog rm -fr exim_rejectlog ; touch exim_rejectlog ; chown mailnull.mail exim_rejectlog To clean the eximstats MySQL database, enter MySQL with: Enter the SQL eximstats DB mysql eximstats SQL commands (to be used within “mysql>”) SQL commands to empty the tables delete from sends; delete from smtp;
  6. Today a strange new customer ordered and purchased an unmanaged VPS with 5 IPs from me. Upon further investigation, the user’s order and ID where problematic, as they had been flagged as fraudulent by Maxmind (and by a few hosting companies as well). Since there is nothing wrong with selling a VPS to anyone, but obliging him/them to a specific SLA and AUP, we can use iptables of the node in order to limit any kind of malevolent behavior and spamming, thus securing our remaining IP addresses from being blacklisted by major spam-listing organisations. IPtables can be configured in the following way: iptables -A FORWARD -o eth0 -p tcp -s --dport 25 -m limit --limit 3/minute -m state --state NEW -j ACCEPT iptables -A FORWARD -o eth0 -p tcp -s --dport 25 -m state --state NEW -j LOG iptables -A FORWARD -o eth0 -p tcp -s --dport 25 -m state --state NEW -j DROP # Limit outgoing mail to 5/hour, plus log and drop anyt surplusing mail. This way we won't cause loss of mail (mailserver will queue/spool and retry), but it will prevent spammers causing too much trouble iptables -A FORWARD -p tcp --sport 25 --syn -m hashlimit --hashlimit-mode srcip --hashlimit-limit 5/hour --hashlimit-burst 6 -j ACCEPT iptables -A FORWARD -p tcp --sport 25 --syn -j LOG iptables -A FORWARD -p tcp --sport 25 --syn -j DROP
  7. Htop is a pretty nice fork of top, which almost makes you forget of using a GUI for simple monitoring tasks. It has pretty nice colours all around your terminal and allows you to have a nice idea of what’s-what, at a glimpse. Run these commands for RHEL/CentOS and Fedora Linux servers yum groupinstall "Development Tools" yum install ncurses ncurses-devel wget http://hisham.hm/htop/releases/2.0.0/htop-2.0.0.tar.gz tar xvfvz htop-2.0.0.tar.gz cd htop-2.0.0 ./configure make make install Or, run these commands for Debian and Ubuntu Linux servers sudo apt-get install build-essential sudo apt-get install libncurses5-dev libncursesw5-dev wget http://hisham.hm/htop/releases/2.0.0/htop-2.0.0.tar.gz tar xvfvz htop-2.0.0.tar.gz cd htop-2.0.0 ./configure make make install If you succesfully followed our instructions, you’ll be able to use htop just by running: htop As simple as that Why we use the source files directly? Well, most tutorials on the internet, make use of EPEL repository. EPEL repo, has been discontinued, so although installing the repo and then running a simple sudo yum or sudo apt-get command to install htop, there is no guarantee that the version you’ve installed will be upgradable to newer versions.
  8. Βιντεάτσι για τους οπτικούς τύπους. Γυρισμένο εξ'ολοκλήρου στα υπερσύγχρονα εργαστήριά μας (σαλοτραπεζαρία)
  9. STEP 1Download the WordPress installation package To start the installation process, first you need to download WordPress from it's official download page. We recommend that you always download and install the latest stable version of WordPress. Once you click on the Download button for the latest WordPress version, the installation package will be saved to your hard disk. Locate the installation package that you've just downloaded and extract it to a new folder. STEP 2Upload the WordPress Files to Your Server Now, you need to upload the extracted files and folders to your web server. The easiest way to upload the installation files is via FTP. For detailed information on how to upload files via FTP, please check our FTP Tutorial. IMPORTANT!If you want your WordPress to be the main installation on your account and to be accessible through your main domain (i.e. www.mydomain.com), you need to upload the extracted files to your public_html folder. Once the download is complete, extract the archive and upload it to your web hosting account. You can do that via FTP using a client application like Filezilla or via cPanel -> File Manager -> Upload file(s). If you want this WordPress installation to be main for your website, the files should reside in the public_html folder of your account. However, you can always make a subfolder (i.e. public_html/blog) if you want to run only part of your website on WordPress. STEP 3Create a MySQL Database for WordPress to use Now, you need to create a MySQL database and assign a user to it with full permissions. For detailed instructions on how to do that, please follow the steps described in our tutorial on How to Create MySQL Username and Database. Once you create your MySQL Database and User, make sure you write down the database name, database username and password you've just created. You will need those for the installation process. STEP 4Go through the installation process Now it's time to navigate to your website to start with the installation process. If you have uploaded WordPress in your public_html directory you'll need to go to http://yourdomain.com in your preferred browser. The first thing you will notice is a message, telling you that you don't have a wp-config.php file and you should create one. Just click on the Create a Configuration File button to proceed. On this page you will see a message, asking you to prepare the necessary information for the installation. Since we already have this information, simply press the Go! button. Enter the details for your newly created MySQL database and press the Submit button WordPress will now check if your settings are correct. If you have entered all the necessary information, you will see a confirmation screen. Press the Run the Install button to proceed. On the next screen you will have to enter the information about your administrative username and the title of your new site. In addition, you can specify whether you'd want search engines to index your site or not. Once you fill in that information, press the Install WordPress button. Bear in mind, however, that you should specify a real email address. It can be later used in case you forget your password. THAT'S IT!Your new WordPress application is installed. You can use the Login In button to access your administrative backend and start posting in your new site.
  10. 1. Run the following outside the preferred account’s public_html folder: chown user:nobody /home/USER/public_html Run the following inside the preferred account’s public_html folder: chown -R user:user /home/USER/public_html find -type f -exec chown user.user {} \; find -type f -exec chmod 644 {} \; find -type d -exec chmod 755 {} \;
  11. Recently i needed to do some housekeeping on my VPS servers, and in my earlier post CPanel Find /Delete all error log files i was mentioning how to find all error log files on a path (in this case, / ). Now i changed some of this command in order to achieve the following. Display the size of each error_log file on the cpanel server Sort the error_log files by size. Most of the times, there is a specific script/account misbehaving, so the error_log file keeps on increasin it’s size. This command helps you find the biggest ones by size. find / -name error_log -type f -exec du -sh {} \; | sort -n You can as well only display the 10 biggest of those error longs, for a quick inquiry on which ones tend to accumulate. Want to delete them all? find /home/ -type f -name error_log -delete ACHTUNG!!! A good admin always reads the error_logs and then decides if they require deletion.
  12. Dirty lil' pr1ck, αλλά τη δουλειά του την κάνει. Θα ανεβάσω με μορφοποίηση μόλις προλάβω να ασχοληθώ: OWNER=$@ KONTA=`ls -1A /var/cpanel/users/` count=1 for x in `echo -n "$KONTA"`;do wiersz=`grep -i ^dns /var/cpanel/users/"$x" |cut -d= -f2` DOMAIN[$count]=$wiersz count=$[$count+1] echo "Login: `echo "$x"`" for i in `echo "${DOMAIN[@]}" | sed 's/ /\n/g'`;do for n in ` ls -A /home/"$x"/mail/"$i"/ 2>/dev/null`;do if [ "$n" == "cur" ];then echo "$n" > /dev/null elif [ "$n" == "new" ];then echo "$n" > /dev/null elif [ "$n" == "tmp" ];then echo "$n" > /dev/null elif [ "$n" == "" ];then echo "$n" > /dev/null else echo "$n"@"$i" fi done done echo;echo; done