Support of the day Posts

Support of the day: Dead Scripts

If you regularly work with scripts on any Unix or Linux platform and it gets killed when you logout from ssh, the session dies or the scripts stops working after x time then you need to deown it and fork it to the background.
So instead of running
/your/script/filename
run
nohup /your/script/filename &
What this does is start the script, the nohup deowns the scripts (meaning that it has no owner so you can logout without killing the process) and the & at the end sends the process to the background. This is the alternative method to run something from within screen but this version works good with a crontab.
FYI the crontab is a file and a program (both named the same) that executes commands (opening files, sending email, any command that you could do via the regular shell) at specific interval or times.

Support of the day: Getting the old Ubuntu desktop back on 10.11

So, you’ve installed Ubuntu 11.10 and found out that it’s all gone and replaced by what seems to be too good of a qualificative of a sidebar and what appears to be a poignant attempt to kill all interest on an open source Operating System. Fear not as we can still make the best of it.
Ubuntu had a very easy, kind interface since the times of 7.04, about 4 years ago, menu on the top, bar on the bottom, happy explorer on the chair, never a miscommunication, yet this has been replaced by a mac-os-ish-windows-7 look. To get rid of this, follow this guide that I’ve just re-checked for you: (more…)

Support of the day: SSH Keys (Passwordless login via SSH)


This week’s tip: SSH Keys (or i do not like typing my long cryptic password everytime I need to access my server)
If you’ve been following my other tips you might remember that ssh uses different authentication options, credentials, domain login, password, you name it, one of these is via ssh keys.


Imagine your car. You’re used to use a key to open the door and start the engine once or twice per day. How about if you were a messenger that has to do this 40, 50, 60 times per day, it gets tiresome, wouldn’t it be great for the car to open the door and automatically start the engine when it senses that it’s you?
Same principle, bit different.
(Please note, that this tutorial is aimed to linux to linux connections, putty has a local key generator that could be technically used as the same.)


1. Creating the keys and their folder
First, create the local folder, type mkdir /home/$USER/.ssh (type it just like that)
Then the key: ssh-keygen -t dsa (anything it asks just press enter)


2. Copying the key to the remote server
Move to the ssh folder: cd /home/$USER/.ssh
Copy the file: scp id_dsa.pub yourremoteuser@remoteip:./id_dsa.pub


3. Adding the key on the remote server
First log in to the remote server via ssh as usual
Then add the key to the remote server’s key list:
cd /home/remoteusername/
mkdir .ssh
mv id_dsa.pub .ssh/
cd .ssh/
check if there is a file named authorized_keys, if not then create it:
touch authorized_keys
finally add the key:
cat id_dsa.pub >> authorized_keys


4. Activating the keys usage on the remote server.
Type: nano /etc/ssh/sshd_config
And look for AuthorizedKeysFile and make sure that it’s uncommented (meaning that there is no # symbol before that word) and that next to it says .ssh/authorized_keys
Save (ctrl + x) and restart the ssh service.


5. Testing.
Log out of the remote server and try to login again, this time it will not ask for a password.

Support of the day: Downgrade PHP 5.3 to 5.2 on CentOS 6

If a downgrade to PHP 5.2 is needed do the following:

1. The repositories for Centos 6 do not include old packages (another reason to stick with 5.6) so we need to pull all packages needed.
Therefore we access the server, create a folder there (mkdir php) and then enter that folder (cd php)

2. Once inside we need to download all packages needed; One trusted source is this: http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/
Once you have opened that on your browser, search for all php- .rpm files that are for your Centos version, there is 32 and 32+64 bits, to know the correct one do a uname –a at the server, if you see it says x86_64 then make sure that all .rpm files you download have that on their names, then

wget them to the server:
Wget http://www6.atomicorp.com/…/RPMS/php-5.2.x.x.x.x.rpm
Once you have downloaded all files that begin with php- proceed to install the following files:
Yum install Automake autoconf libt1*
**make sure to add that ^ asterisk too

3. Once completed then type: rpm –oldpackage -Uvh php*

4. When done, type php –v to check the version, it should say 5.2 – Done

Support of the day: The world’s most dead simple http server

1. Make sure your port 8000 is open
Nano /etc/sysconfig/iptables
Copy any of the rules (ctrl +K is cut, ctrl+U is paste) and swap the port for 8000, save and close
Service iptables restart


2. Go to the folder you want to share
cd /to/any/folder/you/want
3. Fire up the server
python –m SimpleHTTPServer
or
python -m http.server
4. Go to http://yourip:8000


Further information:
This will act as a regular apache server, if on that folder is a index.html file, it will be displayed, otherwise a list of the files on that folder will be shown.
To stop the server just press ctrl + C
To send the process to the background add a & symbol at the very end of any of the python commands
Otherwise press ctrl + Z and then type bg and enter
To stop the process when the above has been done just type:
Ps aux | grep python
Look for the first group of 4 or 5 digits and then type
Kill #####