tag:blogger.com,1999:blog-7668866195101842372024-02-19T09:41:59.118+02:00The technical cribA site for the geek in you, with reminders, software and tutorials.Unknownnoreply@blogger.comBlogger18125tag:blogger.com,1999:blog-766886619510184237.post-14752418871482739062008-01-14T12:14:00.000+02:002008-01-14T12:39:19.451+02:00OLPC Laptop in Ubuntu 7.10This tutorial covers information on how to emulate XO on a typical Linux environment. I will be using Ubuntu Gutsy (7.10) and qemu for emulation.<br /><br />First we need to get qemu.<br /><span style="font-weight: bold;"></span><blockquote><span style="font-weight: bold;">sudo apt-get install qemu</span><br /><span style="font-weight: bold;">sudo apt-get install kqemu-source</span></blockquote>Then we need to prepare the module for using accelerated layer qemu (<a href="http://en.wikipedia.org/wiki/Kqemu#Accelerator">kqemu</a>)<br /><blockquote><span style="font-weight: bold;">sudo module-assistant prepare</span><br /><span style="font-weight: bold;">sudo module assistant auto-install kqemu</span></blockquote><span style="font-weight: bold;"></span> We make the udev rules so it automatically loads the module. Create the file <span style="font-weight: bold;">/etc/udev/rules.d/60-kqemu.rules </span>and write:<br /><blockquote><span style="font-weight: bold;">KERNEL=="kqemu", NAME="%k", GROUP="kqemu", MODE="0660" </span></blockquote><span style="font-weight: bold;"></span>appending a new line.<br /><br />Add a new group and a new user:<br /><span style="font-weight: bold;"></span><blockquote><span style="font-weight: bold;">sudo addgroup --system kqemu</span><br /><span style="font-weight: bold;">sudo adduser $USER kqemu</span></blockquote><span style="font-weight: bold;"></span><ul></ul>Login and logout for changes to take effect and then reload the udev daemon:<br /><span style="font-weight: bold;"></span><blockquote><span style="font-weight: bold;">sudo /etc/init.d/udev reload</span>.</blockquote>Load the kqemu module itself:<br /><span style="font-weight: bold;"></span><blockquote><span style="font-weight: bold;">sudo update-modules</span><br /><span style="font-weight: bold;">sudo modprobe kqemu</span></blockquote><span style="font-weight: bold;"></span>Now, get the XO image from the olpc site:<br /><br /><span style="font-weight: bold;"></span><blockquote><span style="font-weight: bold;">wget http://olpc.download.redhat.com/olpc/streams/development/</span><br /><span style="font-weight: bold;">LATEST-STABLE-BUILD/devel_ext3/</span><br /><span style="font-weight: bold;">olpc-redhat-stream-development-devel_ext3.img.bz2</span><span style="font-weight: bold;"></span><br /></blockquote>and unpack it:<br /><blockquote><span style="font-weight: bold;">bunzip2 olpc-redhat-stream-development-devel_ext3.img.bz2</span></blockquote><span style="font-weight: bold;"></span>Now make your ram partition bigger<br /><span style="font-weight: bold;"></span><blockquote><span style="font-weight: bold;">sudo umount /dev/shm</span><br /><span style="font-weight: bold;">sudo mount -t tmpfs -o size=528m none /dev/shm</span></blockquote><span style="font-weight: bold;"></span>And run it:<br /><span style="font-weight: bold;"><blockquote>qemu -m 512 -hda olpc-redhat-stream-development-devel_ext3.img</blockquote></span><pre style="font-weight: bold;" class="displaycode"><span class="boldcode"></span></pre>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-766886619510184237.post-31346807575750584242007-10-20T00:40:00.001+03:002007-10-20T00:45:49.640+03:00Python Scripting Tutorial, Part twoHere <a href="http://daemon80.blogspot.com/2007/10/python-scripting-tutorial-part-one.html">is my second part</a> of the hands on tutorial on basic python script. It works in an interactive mode just like adduser on a linux system, only<br />it sets a very strong random password (using a little utility called pwgen - you can install it from /usr/ports/sysutils/pwgen2) for the user, gives you<br />the ability of making a system user, a ftp user or both. My pure-ftpd is based on MySQL table auth. It also makes a public_html for the user and<br />build a virtual host for the user. Check the script out because I think it is pretty straightforward. Tweak it a bit so you can use it as your own.<br />On the next tutorial we'll the users a mail with the password and also add them to an LDAP directory. <br />PS: I'm aware that some things could be done more easily by using hefty tricks, but hey, I aimed for easy understanding.<br /><div xmlns="http://www.w3.org/1999/xhtml"><pre style="background: rgb(255, 255, 255) none repeat scroll 0% 50%; color: rgb(0, 0, 0); -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><span style="color: rgb(105, 105, 105);"><span style="color:#000000;"><br /><br /></span>#/usr/local/bin/python</span><br /><span style="color: rgb(128, 0, 0); font-weight: bold;">import</span> os<br /><span style="color: rgb(128, 0, 0); font-weight: bold;">import</span> getopt<br /><span style="color: rgb(128, 0, 0); font-weight: bold;">import</span> sys<br /><span style="color: rgb(128, 0, 0); font-weight: bold;">import</span> MySQLdb<br /><br /><span style="color: rgb(105, 105, 105);"># Where should i write the vhost details?</span><br />VHOSTS_CONFIG <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 0, 230);">"/usr/local/etc/apache22/extra/httpd-vhosts.conf"</span><br /><br /><span style="color: rgb(105, 105, 105);"># Init the variables</span><br />user_flag <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(128, 128, 48);">-</span><span style="color: rgb(0, 140, 0);">1</span><br />ftp_flag <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(128, 128, 48);">-</span><span style="color: rgb(0, 140, 0);">1</span><br /><br /><span style="color: rgb(105, 105, 105);"># MySQL authentification variables</span><br />mysql_user <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 0, 230);">"user"</span><br />mysql_pass <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 0, 230);">"password"</span><br />mysql_host <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 0, 230);">"localhost"</span><br />mysql_database <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 0, 230);">"pureftpd"</span><br /><br /><span style="color: rgb(105, 105, 105);"># The usage() function that gets used when we call the script with the -h option </span><br /><span style="color: rgb(128, 0, 0); font-weight: bold;">def</span> usage<span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(128, 128, 48);">)</span><span style="color: rgb(128, 128, 48);">:</span><br /> <span style="color: rgb(128, 0, 0); font-weight: bold;">print</span> <span style="color: rgb(105, 105, 105);">"""</span><br /><span style="color: rgb(105, 105, 105);">Usage: sudo python create_python.py : create a user in the system.</span><br /><span style="color: rgb(105, 105, 105);">You can create a ftp user only, a system user or both.</span><br /><span style="color: rgb(105, 105, 105);">It also adds the corresponding vhost to the configuration and builds the </span><br /><span style="color: rgb(105, 105, 105);">home directory. If run with no arguments it will go into interactive mode.</span><br /><span style="color: rgb(105, 105, 105);"><br /><span style="color: rgb(105, 105, 105);">create_user.py [-h]</span><br /><span style="color: rgb(105, 105, 105);"><br /><span style="color: rgb(105, 105, 105);"> -h print this help</span><br /><span style="color: rgb(105, 105, 105);">"""</span><br /><br /><span style="color: rgb(105, 105, 105);"># Parse the command line arguments</span><br /><span style="color: rgb(105, 105, 105);"># Basicly this looks for the -h argument only but could be<br /># easily extended to something else</span><br />o<span style="color: rgb(128, 128, 48);">,</span> a <span style="color: rgb(128, 128, 48);">=</span> getopt<span style="color: rgb(128, 128, 48);">.</span>getopt<span style="color: rgb(128, 128, 48);">(</span>sys<span style="color: rgb(128, 128, 48);">.</span>argv<span style="color: rgb(128, 128, 48);">[</span><span style="color: rgb(0, 140, 0);">1</span><span style="color: rgb(128, 128, 48);">:</span><span style="color: rgb(128, 128, 48);">]</span><span style="color: rgb(128, 128, 48);">,</span> <span style="color: rgb(0, 0, 230);">'h'</span><span style="color: rgb(128, 128, 48);">)</span><br />opts <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(128, 0, 128);">{</span><span style="color: rgb(128, 0, 128);">}</span><br /><span style="color: rgb(128, 0, 0); font-weight: bold;">for</span> k<span style="color: rgb(128, 128, 48);">,</span>v <span style="color: rgb(128, 0, 0); font-weight: bold;">in</span> o<span style="color: rgb(128, 128, 48);">:</span><br /> opts<span style="color: rgb(128, 128, 48);">[</span>k<span style="color: rgb(128, 128, it sets a very strong random password (using a little utility called pwgen - you can install it from /usr/ports/sysutils/pwgen2) for the user, gives you<br />the ability of making a system user, a ftp user or both. My pure-ftpd is based on MySQL table auth. It also makes a public_html for the user and<br />build a virtual host for the user. Check the script out because I think it is pretty straightforward. Tweak it a bit so you can use it as your own.<br />On the next tutorial we'll the users a mail with the password and also add them to an LDAP directory.<br />PS: I'm aware that some things could be done more easily by using hefty tricks, but hey, I aimed for easy understanding.48);">]</span> <span style="color: rgb(128, 128, 48);">=</span> v<br /><span style="color: rgb(128, 0, 0); font-weight: bold;">if</span> opts<span style="color: rgb(128, 128, 48);">.</span>has_key<span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(0, 0, 230);">'-h'</span><span style="color: rgb(128, 128, 48);">)</span><span style="color: rgb(128, 128, 48);">:</span><br /> usage<span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(128, 128, 48);">)</span><span style="color: rgb(128, 128, 48);">;</span><br /> sys<span style="color: rgb(128, 128, 48);">.</span><span style="color: rgb(227, 74, 220);">exit</span><span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(0, 140, 0);">0</span><span style="color: rgb(128, 128, 48);">)</span><br /><br /><span style="color: rgb(105, 105, 105);"># Check to see if we're running as superuser</span><br />uid <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(227, 74, 220);">`os.getuid()`</span><br /><span style="color: rgb(128, 0, 0); font-weight: bold;">if</span> uid <span style="color: rgb(128, 128, 48);">!</span><span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 0, 230);">"0"</span><span style="color: rgb(128, 128, 48);">:</span><br /> <span style="color: rgb(128, 0, 0); font-weight: bold;">print</span> <span style="color: rgb(0, 0, 230);">"You must be superuser in order to run this program"</span><br /> sys<span style="color: rgb(128, 128, 48);">.</span><span style="color: rgb(227, 74, 220);">exit</span><span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(0, 140, 0);">1</span><span style="color: rgb(128, 128, 48);">)</span><br /><br /><span style="color: rgb(105, 105, 105);"># Make a system user?</span><br />user_input <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(227, 74, 220);">raw_input</span><span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(0, 0, 230);">"Do you want to add a system user [n/Y]: "</span><span style="color: rgb(128, 128, 48);">)</span><br /><span style="color: rgb(128, 0, 0); font-weight: bold;">if</span> user_input<span style="color: rgb(128, 128, 48);">.</span>lower<span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(128, 128, 48);">)</span> <span style="color: rgb(128, 128, 48);">=</span><span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 0, 230);">"y"</span><span style="color: rgb(128, 128, 48);">:</span><br /> user_flag <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 140, 0);">1</span><br /><span style="color: rgb(128, 0, 0); font-weight: bold;">if</span> user_input<span style="color: rgb(128, 128, 48);">.</span>lower<span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(128, 128, 48);">)</span> <span style="color: rgb(128, 128, 48);">=</span><span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 0, 230);">"n"</span><span style="color: rgb(128, 128, 48);">:</span><br /> user_flag <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 140, 0);">0</span><br /><span style="color: rgb(128, 0, 0); font-weight: bold;">else</span><span style="color: rgb(128, 128, 48);">:</span><br /> user_flag <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 140, 0);">1</span><br /><br /><span style="color: rgb(105, 105, 105);"># Make a ftp user?</span><br />ftp_input <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(227, 74, 220);">raw_input</span><span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(0, 0, 230);">"Do you want to add a ftp user [n/Y]: "</span><span style="color: rgb(128, 128, 48);">)</span><br /><span style="color: rgb(128, 0, 0); font-weight: bold;">if</span> ftp_input<span style="color: rgb(128, 128, 48);">.</span>lower<span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(128, 128, 48);">)</span> <span style="color: rgb(128, 128, 48);">=</span><span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 0, 230);">"y"</span><span style="color: rgb(128, 128, 48);">:</span><br /> ftp_flag <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 140, 0);">1</span><br /><span style="color: rgb(128, 0, 0); font-weight: bold;">if</span> ftp_input<span style="color: rgb(128, 128, 48);">.</span>lower<span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(128, 128, 48);">)</span> <span style="color: rgb(128, 128, 48);">=</span><span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 0, 230);">"n"</span><span style="color: rgb(128, 128, 48);">:</span><br /> ftp_flag <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 140, 0);">0</span><br /><span style="color: rgb(128, 0, 0); font-weight: bold;">else</span><span style="color: rgb(128, 128, 48);">:</span><br /> ftp_flag <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 140, 0);">1</span><br /><br /><span style="color: rgb(105, 105, 105);"># If you do not want a system user or a ftp user then ... you don't want anything</span><br /><span style="color: rgb(128, 0, 0); font-weight: bold;">if</span> ftp_flag <span style="color: rgb(128, 128, 48);">=</span><span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 140, 0);">0</span> <span style="color: rgb(128, 0, 0); font-weight: bold;">and</span> user_flag <span style="color: rgb(128, 128, 48);">=</span><span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 140, 0);">0</span><span style="color: rgb(128, 128, 48);">:</span><br /> <span style="color: rgb(128, 0, 0); font-weight: bold;">print</span> <span style="color: rgb(0, 0, 230);">"Come back when you know what you want"</span><br /> sys<span style="color: rgb(128, 128, 48);">.</span><span style="color: rgb(227, 74, 220);">exit</span><span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(128, 128, 48);">)</span><br /><br /><span style="color: rgb(105, 105, 105);"># How do you want to name your user?</span><br />user_name <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(227, 74, 220);">raw_input</span><span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(0, 0, 230);">"Username: "</span><span style="color: rgb(128, 128, 48);">)</span><br /><br /><span style="color: rgb(105, 105, 105);"># Try to figure out the shell or input another shell</span><br /><span style="color: rgb(105, 105, 105);"># something like /usr/local/bin/rssh</span><br /><span style="color: rgb(128, 0, 0); font-weight: bold;">if</span> user_flag <span style="color: rgb(128, 128, 48);">=</span><span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 140, 0);">1</span><span style="color: rgb(128, 128, 48);">:</span><br /> user_shell <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(227, 74, 220);">raw_input</span><span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(0, 0, 230);">"Shell [/usr/local/bin/bash]: "</span><span style="color: rgb(128, 128, 48);">)</span><br /> <span style="color: rgb(105, 105, 105);"># Make /usr/local/bin/bash the default shell if the user presses enter</span><br /> <span style="color: rgb(128, 0, 0); font-weight: bold;">if</span> user_shell <span style="color: rgb(128, 128, 48);">=</span><span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 0, 230);">""</span><span style="color: rgb(128, 128, 48);">:</span><br /> user_shell <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 0, 230);">"/usr/local/bin/bash"</span><br /><br /><span style="color: rgb(105, 105, 105);"># Basicly we have to types of accounts</span><br /><span style="color: rgb(105, 105, 105);"># Those that are the system users with ssh account and those with only ftp access</span><br /><span style="color: rgb(105, 105, 105);"># System users have the /home/user directory<br /># whilst the ftp users have /home/ftpusers/user</span><br /><span style="color: rgb(128, 0, 0); font-weight: bold;">if</span> user_flag <span style="color: rgb(128, 128, 48);">=</span><span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 140, 0);">1</span><span style="color: rgb(128, 128, 48);">:</span><br /> home <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 0, 230);">"/home/"</span> <span style="color: rgb(128, 128, 48);">+</span> user_name<br /><span style="color: rgb(128, 0, 0); font-weight: bold;">else</span><span style="color: rgb(128, 128, 48);">:</span><br /> home <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 0, 230);">"/home/ftpusers/"</span> <span style="color: rgb(128, 128, 48);">+</span> user_name<br /><br /><span style="color: rgb(105, 105, 105);"># But if you want you can input another directory as the home directory</span><br /><span style="color: rgb(105, 105, 105);"># We are making this script a little more interactive</span><br />home_dir <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(227, 74, 220);">raw_input</span><span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(0, 0, 230);">"Home directory ["</span> <span style="color: rgb(128, 128, 48);">+</span> home <span style="color: rgb(128, 128, 48);">+</span> <span style="color: rgb(0, 0, 230);">"]: "</span><span style="color: rgb(128, 128, 48);">)</span><br /><span style="color: rgb(128, 0, 0); font-weight: bold;">if</span> home_dir <span style="color: rgb(128, 128, 48);">=</span><span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 0, 230);">""</span><span style="color: rgb(128, 128, 48);">:</span><br /> home_dir <span style="color: rgb(128, 128, 48);">=</span> home<br /><br /><span style="color: rgb(105, 105, 105);"># We generate a new random password. This is based on the pwgen port</span><br /><span style="color: rgb(105, 105, 105);"># Please install it before if you don't have it:</span><br /><span style="color: rgb(105, 105, 105);"># cd /usr/ports/sysutils/pwgen2 && sudo make search install</span><br />newpassword <span style="color: rgb(128, 128, 48);">=</span> os<span style="color: rgb(128, 128, 48);">.</span>popen<span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(0, 0, 230);">"pwgen -s -n -B -c 12 1"</span><span style="color: rgb(128, 128, 48);">)</span><span style="color: rgb(128, 128, 48);">.</span>readline<span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(128, 128, 48);">)</span><span style="color: rgb(128, 128, 48);">.</span>split<span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(128, 128, 48);">)</span><span style="color: rgb(128, 128, 48);">[</span><span style="color: rgb(128, 128, 48);">-</span><span style="color: rgb(0, 140, 0);">1</span><span style="color: rgb(128, 128, 48);">]</span><br /><span style="color: rgb(128, 0, 0); font-weight: bold;">if</span> user_flag <span style="color: rgb(128, 128, 48);">=</span><span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 140, 0);">1</span><span style="color: rgb(128, 128, 48);">:</span><br /> <span style="color: rgb(105, 105, 105);"># Add the new user using the randomly generated password earlier</span><br /> <span style="color: rgb(105, 105, 105);"># This command enters:</span><br /> <span style="color: rgb(105, 105, 105);"># echo pass | pw user add -d /home/user -m -s /usr/local/bin/bash -n user -g users -h 0</span><br /> <span style="color: rgb(105, 105, 105);"># -d - home directory</span><br /> <span style="color: rgb(105, 105, 105);"># -m - builds the home directory if it doesn't exist</span><br /> <span style="color: rgb(105, 105, 105);"># -s - the shell to user</span><br /> <span style="color: rgb(105, 105, 105);"># -n - the name of the user</span><br /> <span style="color: rgb(105, 105, 105);"># -g - the original group for the user</span><br /> <span style="color: rgb(105, 105, 105);"># -h 0 - get the password from stdin</span><br /> cmd <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 0, 230);">"echo "</span> <span style="color: rgb(128, 128, 48);">+</span> newpassword <span style="color: rgb(128, 128, 48);">+</span> <span style="color: rgb(0, 0, 230);">" | pw user add -d "</span> <span style="color: rgb(128, 128, 48);">+</span> home_dir <span style="color: rgb(128, 128, 48);">+</span> <span style="color: rgb(0, 0, 230);">" -m -s "</span> <span style="color: rgb(128, 128, 48);">+</span> user_shell <span style="color: rgb(128, 128, 48);">+</span> <span style="color: rgb(0, 0, 230);">" -n "</span> <span style="color: rgb(128, 128, 48);">+</span> user_name <span style="color: rgb(128, 128, 48);">+</span> <span style="color: rgb(0, 0, 230);">" -g users -h 0"</span><br /> os<span style="color: rgb(128, 128, 48);">.</span>system<span style="color: rgb(128, 128, 48);">(</span>cmd<span style="color: rgb(128, 128, 48);">)</span><br /> <span style="color: rgb(105, 105, 105);"># Save the new password somewhere as you don't want an inactive account or manually input another pasword</span><br /> f <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(227, 74, 220);">open</span><span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(0, 0, 230);">"/root/accounts"</span><span style="color: rgb(128, 128, 48);">,</span> <span style="color: rgb(0, 0, 230);">"a+"</span><span style="color: rgb(128, 128, 48);">)</span><br /> line <span style="color: rgb(128, 128, 48);">=</span> user_name <span style="color: rgb(128, 128, 48);">+</span> <span style="color: rgb(0, 0, 230);">" "</span> <span style="color: rgb(128, 128, 48);">+</span> newpassword <span style="color: rgb(128, 128, 48);">+</span> <span style="color: rgb(0, 0, 230);">" "</span> <span style="color: rgb(128, 128, 48);">+</span> <span style="color: rgb(227, 74, 220);">`user_flag` + " " + `ftp_flag`</span> <span style="color: rgb(128, 128, 48);">+</span> <span style="color: rgb(0, 0, 230);">"\n"</span><br /> f<span style="color: rgb(128, 128, 48);">.</span>write<span style="color: rgb(128, 128, 48);">(</span>line<span style="color: rgb(128, 128, 48);">)</span><br /> f<span style="color: rgb(128, 128, 48);">.</span>close<span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(128, 128, 48);">)</span><br /> <span style="color: rgb(128, 0, 0); font-weight: bold;">print</span> <span style="color: rgb(0, 0, 230);">"Details have been saved to /root/accounts. Please mail the information to the user and then delete the file"</span><br /> <span style="color: rgb(105, 105, 105);"># Make the /home/user/public_html directory so the user can have his own web server</span><br /> <span style="color: rgb(105, 105, 105);"># at the http://host/~user address</span><br /> os<span style="color: rgb(128, 128, 48);">.</span>mkdir<span style="color: rgb(128, 128, 48);">(</span>home_dir <span style="color: rgb(128, 128, 48);">+</span> <span style="color: rgb(0, 0, 230);">"/public_html"</span><span style="color: rgb(128, 128, 48);">)</span><br /> <span style="color: rgb(105, 105, 105);"># Change the vhost configuration to a new entry so </span><br /> <span style="color: rgb(105, 105, 105);"># http://host/~user is mapped as http://user.host/</span><br /> <span style="color: rgb(105, 105, 105);"># This is much more professional in my opinion</span><br /> f <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(227, 74, 220);">open</span><span style="color: rgb(128, 128, 48);">(</span>VHOSTS_CONFIG<span style="color: rgb(128, 128, 48);">,</span> <span style="color: rgb(0, 0, 230);">"a"</span><span style="color: rgb(128, 128, 48);">)</span><br /> vhost <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(105, 105, 105);">"""&lt;VirtualHost *:80&gt;</span><br /><span style="color: rgb(105, 105, 105);"> ServerAdmin </span><span style="color: rgb(113, 68, 196);">email@mail.com</span><span style="color: rgb(105, 105, 105);"><br /><span style="color: rgb(105, 105, 105);"> DocumentRoot """</span> <span style="color: rgb(128, 128, 48);">+</span> home_dir <span style="color: rgb(128, 128, 48);">+</span> <span style="color: rgb(105, 105, 105);">"""/public_html</span><br /><span style="color: rgb(105, 105, 105);"> ServerName """</span> <span style="color: rgb(128, 128, 48);">+</span> user_name <span style="color: rgb(128, 128, 48);">+</span> <span style="color: rgb(105, 105, 105);">""".host</span><br /><span style="color: rgb(105, 105, 105);"> ErrorLog /var/log/httpd/"""</span> <span style="color: rgb(128, 128, 48);">+</span> user_name <span style="color: rgb(128, 128, 48);">+</span> <span style="color: rgb(105, 105, 105);">"""-error_log</span><br /><span style="color: rgb(105, 105, 105);"> CustomLog /var/log/httpd/"""</span> <span style="color: rgb(128, 128, 48);">+</span> user_name <span style="color: rgb(128, 128, 48);">+</span> <span style="color: rgb(105, 105, 105);">"""-access_log combined</span><br /><span style="color: rgb(105, 105, 105);">&lt;/VirtualHost&gt;</span><br /><span style="color: rgb(105, 105, 105);"> """</span><br /> f<span style="color: rgb(128, 128, 48);">.</span>write<span style="color: rgb(128, 128, 48);">(</span>vhost<span style="color: rgb(128, 128, 48);">)</span><br /> f<span style="color: rgb(128, 128, 48);">.</span>close<span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(128, 128, 48);">)</span><br /> <span style="color: rgb(105, 105, 105);"># Restart the Apache Webserver</span><br /> os<span style="color: rgb(128, 128, 48);">.</span>system<span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(0, 0, 230);">"apachectl graceful"</span><span style="color: rgb(128, 128, 48);">)</span><br /><span style="color: rgb(105, 105, 105);"># For the ftp users only you should manage their accounts using the system account ftpusers</span><br /><span style="color: rgb(128, 0, 0); font-weight: bold;">if</span> user_flag <span style="color: rgb(128, 128, 48);">=</span><span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 140, 0);">0</span> <span style="color: rgb(128, 0, 0); font-weight: bold;">and</span> ftp_flag <span style="color: rgb(128, 128, 48);">=</span><span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 140, 0);">1</span><span style="color: rgb(128, 128, 48);">:</span><br /> group <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 0, 230);">"ftpusers"</span><br /> uid <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 0, 230);">"ftpusers"</span><br /><span style="color: rgb(128, 0, 0); font-weight: bold;">else</span><span style="color: rgb(128, 128, 48);">:</span><br /> uid <span style="color: rgb(128, 128, 48);">=</span> user_name<br /> group <span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 0, 230);">"users"</span><br /><span style="color: rgb(105, 105, 105);"># Add the ftp user to the existing MySQL table (I do MySQL auth to my ftp server)<br /># with the same use </span><span style="color: rgb(105, 105, 105);">so if you give ftp access to a system user he can login with<br /># the same password </span><span style="color: rgb(105, 105, 105);">You should only give a user access to the system with no ftp<br /># access if you want him to make transactions</span><span style="color: rgb(105, 105, 105);"> only with ssh (through scp)</span><br /><span style="color: rgb(128, 0, 0); font-weight: bold;">if</span> ftp_flag <span style="color: rgb(128, 128, 48);">=</span><span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 140, 0);">1</span><span style="color: rgb(128, 128, 48);">:</span><br /> <span style="color: rgb(105, 105, 105);"># Open the MySQL database</span><br /> db <span style="color: rgb(128, 128, 48);">=</span> MySQLdb<span style="color: rgb(128, 128, 48);">.</span>connect<span style="color: rgb(128, 128, 48);">(</span>mysql_host<span style="color: rgb(128, 128, 48);">,</span>mysql_user<span style="color: rgb(128, 128, 48);">,</span>mysql_pass<span style="color: rgb(128, 128, 48);">,</span>mysql_database<span style="color: rgb(128, 128, 48);">)</span><br /> <span style="color: rgb(105, 105, 105);"># Make a cursor (a pointer to that database)</span><br /> cursor <span style="color: rgb(128, 128, 48);">=</span> db<span style="color: rgb(128, 128, 48);">.</span>cursor<span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(128, 128, 48);">)</span><br /> <span style="color: rgb(105, 105, 105);"># Execute an insert query</span><br /> cursor<span style="color: rgb(128, 128, 48);">.</span>execute<span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(0, 0, 230);">"INSERT INTO `pureftpd`.`users` (`User`, `Password`, `Uid`, `Gid`, `Dir`, `QuotaSize`) VALUES (\'%s', MD5(\'%s\'), \'%s\', \'%s\', \'%s\', \'%s\');"</span> <span style="color: rgb(128, 128, 48);">%</span> <span style="color: rgb(128, 128, 48);">(</span>user_name<span style="color: rgb(128, 128, 48);">,</span>newpassword<span style="color: rgb(128, 128, 48);">,</span>uid<span style="color: rgb(128, 128, 48);">,</span>group<span style="color: rgb(128, 128, 48);">,</span>home_dir<span style="color: rgb(128, 128, 48);">,</span><span style="color: rgb(0, 140, 0);">100</span><span style="color: rgb(128, 128, 48);">)</span><span style="color: rgb(128, 128, 48);">)</span><br /> cursor<span style="color: rgb(128, 128, 48);">.</span>close<span style="color: rgb(128, 128, 48);">(</span><span style="color: rgb(128, 128, 48);">)</span><br /> <span style="color: rgb(128, 0, 0); font-weight: bold;">if</span> ftp_flag <span style="color: rgb(128, 128, 48);">=</span><span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 140, 0);">1</span> <span style="color: rgb(128, 0, 0); font-weight: bold;">and</span> user_flag <span style="color: rgb(128, 128, 48);">=</span><span style="color: rgb(128, 128, 48);">=</span> <span style="color: rgb(0, 140, 0);">0</span><span style="color: rgb(128, 128, 48);">:</span><br /> os<span style="color: rgb(128, 128, 48);">.</span>mkdir<span style="color: rgb(128, 128, 48);">(</span>home_dir<span style="color: rgb(128, 128, 48);">)</span><br /></span></span></span></pre><br /><br /><p class="poweredbyperformancing">Powered by <a href="http://scribefire.com/">ScribeFire</a>.</p></div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-766886619510184237.post-79359187249125376932007-10-15T14:09:00.000+03:002007-10-15T14:16:51.437+03:00Solved the PHP Segmentation FaultHa. <a href="http://daemon80.blogspot.com/2007/10/php-annoying-error.html">I figured it all out</a>. After some exhausting work my apache+php installation is working okay.<br />What I did is comment all lines in /usr/local/etc/php/extensions.ini and then uncommented line by line and testing php over and over again in cli mode. This took about 15 minutes of <a href="http://en.wikipedia.org/wiki/Repetitive_strain_injury">RSI</a>-proof work. My error was due to the recode extension. I just commented the line and everything works okay. Unfortunately, reinstalling the extension just won't do the trick. As I see, there are some topics on this to be found on google but none have a solution. I'll have to look into it.<br /><br />Note to self: Stop installing every god damn tidbit in extensions. Use only what necessary fool!Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-766886619510184237.post-5803459319904480642007-10-15T13:48:00.000+03:002007-10-15T14:17:05.494+03:00PHP annoying errorI just installed apache on a new box using freebsd. Everything seems to work just fine. But i then tried to install php5 and php5 extensions and apache won't even start. /var/log/messages says something about a segmentation fault. php in the command line says core dumped. I'm getting frustated as this is surely an error related to the updated ports collection I have (as everything worked perfectly a few weeks ago).Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-766886619510184237.post-25333871892633290322007-10-13T19:04:00.001+03:002007-10-13T19:16:56.680+03:00How to keep your FreeBSD box up to date<div xmlns="http://www.w3.org/1999/xhtml">Here is a quick but time-consuming way of keeping your ports up to date. First we will install portaudit to see what ports need upgrading because of vulnerability issues. Than we will install portupgrade which is a program for upgrading your system.<br /><b><br />Portaudit<br /></b><pre class="code">portaudit provides a system to check if installed ports are listed in a<br />database of published security vulnerabilities.<br /></pre><span style="color: rgb(0, 0, 153);">cd /usr/ports/ports-mgmt/portaudit</span><br /><span style="color: rgb(0, 0, 153);">make install clean</span><br /><span style="color: rgb(0, 0, 153);">portaudit -Fda</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTO1pQY82IK6lySVkSJP8TCnxks6MQgrLJwx4Pz5ZVA5clnIDgl8cCbu5NuCibD6pgwF8XwelSisDpsLaMj6NTA2BEE75N2qAzwejbbAStYJxEvema0pamRqmJ_POur0R-KMUwuVzFVIo/s1600-h/updating_freebsd1_portaudit"><img style="cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTO1pQY82IK6lySVkSJP8TCnxks6MQgrLJwx4Pz5ZVA5clnIDgl8cCbu5NuCibD6pgwF8XwelSisDpsLaMj6NTA2BEE75N2qAzwejbbAStYJxEvema0pamRqmJ_POur0R-KMUwuVzFVIo/s320/updating_freebsd1_portaudit" alt="" id="BLOGGER_PHOTO_ID_5120853207181093410" border="0" /></a><br /><br /><b>Portupgrade<br /></b><pre class="code">Portupgrade is a tool to upgrade installed packages via ports or<br />packages. You can upgrade installed packages without having to<br />reinstall depending or dependent packages. It can automatically trace<br />dependency chains up and down upgrading packages recursively.</pre><span style="color: rgb(0, 0, 153);">cd /usr/ports/ports-mgmt/portupgrade</span><br /><span style="color: rgb(0, 0, 153);">make install clean</span><br /><br />Let's now update the ports collection using the built in portsnap.<br /><br /><span style="color: rgb(0, 0, 153);">portsnap fetch</span><br /><span style="color: rgb(0, 0, 153);">portsnap update</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEir5FB5BoASY_16y82TQAQggmHSuLv1G9IzTz3TLhMuc0_rLX6s2vVVPjnPxB838p9O4_p6NWjDpz4j0ZXQ5NdDHBmRiq0NTbqlTvho5cZDkhjwjVE8FUjcbg57SAHoOkFqXJB1quKeF3s/s1600-h/updating_freebsd2_portsnap"><img style="cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEir5FB5BoASY_16y82TQAQggmHSuLv1G9IzTz3TLhMuc0_rLX6s2vVVPjnPxB838p9O4_p6NWjDpz4j0ZXQ5NdDHBmRiq0NTbqlTvho5cZDkhjwjVE8FUjcbg57SAHoOkFqXJB1quKeF3s/s320/updating_freebsd2_portsnap" alt="" id="BLOGGER_PHOTO_ID_5120853602318084658" border="0" /></a><br /><br />After your ports collection update is completed you should run the following command and building a new database for the portupgrade program. Beware as this takes a LOT.<br /><br /><span style="color: rgb(0, 0, 153);">portsdb -Uu</span><br /><br />The actual upgrading is done with:<br /><br /><span style="color: rgb(0, 0, 153);">portupgrade -arR</span><br /><br />By the way to see what packages are outdated type at the command prompt:<br /><span style="color: rgb(0, 0, 153);">pkg_version -l "<" </span><br /><br />That's it. You should now have an up to date system. All you need to do now is automate this task by adding all the commands in a shell file and throwing it at cron.<br /></div>Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-766886619510184237.post-85530976334483000392007-10-07T20:18:00.001+03:002007-10-07T20:18:53.268+03:00How-to: Make Firefox default browser for Thunderbird<div xmlns='http://www.w3.org/1999/xhtml'>One thing that bugged the hell out of me was the fact that Thunderbird did not know about Firefox. I get a lot of RSS feeds in my inbox and the damn things just won't open. So what you say? "You just click the link and magically Firefox starts with a new tab and the most sought after page". Wrong. What you have to do is ctrl-click the link, click on "copy link location", do an alt-tab, paste the link in firefox and then press enter while you are controlling yourself from pounding every object that's on your desk . I mean, how hard can it be for the great Mozilla Foundation to integrate the two seamlessly and without any tweaks in the configs? Don't get me wrong. I do love their products. But in my opinion this is one of those cases where some polish (sorry Poland people) will come in handy. So, until they came up for a better way of selecting a default browser here is the way to go:<br/><br/><ul><li>Fire up Thunderbird.</li><li>Go to Edit - Preferences - Advanced - General - Config editor</li><li>Make a new string <b>network.protocol-handler.app.http</b> with <b>/opt/mozilla/bin/firefox</b></li><li>Same for <b>network.protocol-handler.app.http - /opt/mozilla/bin/firefox</b></li></ul><br/>Who in their right mind will use the same application for https and http anyway? Sheesh. Strange f*cking world we're leaving in. :)<br/><br/><br/><p class='poweredbyperformancing'>Powered by <a href='http://scribefire.com/'>ScribeFire</a>.</p></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-766886619510184237.post-23732370943095321382007-10-05T22:47:00.001+03:002007-10-05T22:54:33.895+03:00Python Scripting Tutorial, Part one<div xmlns="http://www.w3.org/1999/xhtml"><b>Introduction<br /><br /></b>Python is a great tool to work with. I like the fact that I can accomplish all sorts of tasks, from socket programming to web development to GUI) in just one language. Python has an incredible standard library, it is very readable and I found it to be very fast. I prefer it over BASH because it seems I just can make the damn thing work.<br /><br />In this series, we'll first start on with some very simple scripts and then move on, developing on those and adding more features. This is a hands-on tutorial, because you have to write the code and try to understand it. As I always comment my code excessively when writing tutorials, I won't explain the same thing twice.<br /><br />In this part you will learn how to:<br /><ul><li>find out if a program is running by searching for its pid</li><li>get simple command line arguments</li><li>learn what a list is and how to access it<br /></li></ul><b>Scenario<br /><br /></b>As you may already know, I have moved my sshd port to 8722 on my servers (they are all in sync). Also, I use only public/private keys for authentification using ssh-agent and ssh-add. I found it very cumbersome that everytime I want to ssh to see if ssh-agent is already running, then if it's not, ssh-add the key, and type that long command. Here is the command that I actually type to get into one of my hosts:<br /><br /><span style="color: rgb(51, 0, 153);">ssh rsavu@host1 -p 8722<br /><br /><span style="color: rgb(0, 0, 0);">The problem is I don't have any short hosts like <i>host1</i> in /etc/hosts and I just want to make a script that automates this task (okay, admit I need it just for the sake of argument).<br /><br />What should the script do? Well, if it receives an argument (user@host is necessary) it should connect to that host using the port 8722. If it doesn't receive any arguments it should print a menu with known hosts.<br /><br /><b>What to improve on in the next parts<br /><br /></b></span></span><ul><li>check if the format of the first argument is user@host</li><li>read hosts from /etc/hosts</li><li>read all other options from a configuration file that can be thrown through a command line argument or be a predefined one</li><li>suppressing any warnings<br /></li></ul><b>The script</b><br /><br /><pre style="background: rgb(255, 255, 255) none repeat scroll 0% 50%; color: rgb(0, 0, 0); -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><span style="color: rgb(63, 127, 89);">#!/usr/bin/python</span><br /><span style="color: rgb(63, 127, 89);">""" </span><br /><span style="color: rgb(63, 127, 89);"> That thing above is called a shabang line for anyone that did not know that</span><br /><span style="color: rgb(63, 127, 89);"> It instructs the shell what interpreter should be used for the following</span><br /><span style="color: rgb(63, 127, 89);"> lines of code</span><br /><span style="color: rgb(63, 127, 89);">"""</span><br /><br /><span style="color: rgb(63, 127, 89);">"""</span><br /><span style="color: rgb(63, 127, 89);"> These are the libraries we are going to work with.</span><br /><span style="color: rgb(63, 127, 89);">"""</span><br /><span style="color: rgb(127, 0, 85); font-weight: bold;">import</span> sys<br /><span style="color: rgb(127, 0, 85); font-weight: bold;">import</span> os<br /><span style="color: rgb(63, 127, 89);">"""</span><br /><span style="color: rgb(63, 127, 89);"> The main function</span><br /><span style="color: rgb(63, 127, 89);">"""</span><br /><span style="color: rgb(127, 0, 85); font-weight: bold;">def</span> main(argv):<br /><span style="color: rgb(63, 127, 89);"># First let's find out if ssh-agent is working</span><br />pid = os.system(<span style="color: rgb(42, 0, 255);">"pidof -s ssh-agent"</span>)<br /><span style="color: rgb(127, 0, 85); font-weight: bold;">if</span> pid == 256:<br /> os.system(<span style="color: rgb(42, 0, 255);">"ssh-agent"</span>)<br /> os.system(<span style="color: rgb(42, 0, 255);">"ssh-add"</span>)<br /><span style="color: rgb(63, 127, 89);"># Let's see how many arguments we have</span><br />argc = len(argv)<br /><span style="color: rgb(63, 127, 89);"># Test if we don't have any argument</span><br /><span style="color: rgb(127, 0, 85); font-weight: bold;">if</span> argc == 1:<br /> <span style="color: rgb(63, 127, 89);"># This is a list</span><br /> knownHosts = [<span style="color: rgb(42, 0, 255);">"user@host1"</span>, <span style="color: rgb(42, 0, 255);">"user@host2"</span>]<br /> printTable(knownHosts)<br /> <span style="color: rgb(63, 127, 89);"># Request some input from the user and transform it in an integer</span><br /> option = int(raw_input(<span style="color: rgb(42, 0, 255);">"Choose an option: "</span>))<br /> remoteHost = knownHosts[option-1]<br /><span style="color: rgb(127, 0, 85); font-weight: bold;">elif</span> argc == 2:<br /> remoteHost = argv[1]<br />cmd = <span style="color: rgb(42, 0, 255);">'ssh '</span> + remoteHost + <span style="color: rgb(42, 0, 255);">' -p 8722'</span><br /><span style="color: rgb(127, 0, 85); font-weight: bold;">print</span> cmd<br /><br /><span style="color: rgb(63, 127, 89);">"""</span><br /><span style="color: rgb(63, 127, 89);"> Prints a table with know hosts</span><br /><span style="color: rgb(63, 127, 89);">"""</span><br /><span style="color: rgb(127, 0, 85); font-weight: bold;">def</span> printTable(knownHosts):<br />i = 1<br /><span style="color: rgb(127, 0, 85); font-weight: bold;">for</span> host <span style="color: rgb(127, 0, 85); font-weight: bold;">in</span> knownHosts:<br /> <span style="color: rgb(63, 127, 89);"># In the next line the statement `i` makes us able concat a string and int</span><br /> <span style="color: rgb(127, 0, 85); font-weight: bold;">print</span> `i` + <span style="color: rgb(42, 0, 255);">". "</span> + host<br /> i = i+1<br /><br /><span style="color: rgb(63, 127, 89);">""" </span><br /><span style="color: rgb(63, 127, 89);"> This basically means that if this file is ran independently and not included </span><br /><span style="color: rgb(63, 127, 89);"> in any other file it should call function main with that argument.</span><br /><span style="color: rgb(63, 127, 89);"> More on this another time</span><br /><span style="color: rgb(63, 127, 89);">"""</span><br /><span style="color: rgb(127, 0, 85); font-weight: bold;">if</span> __name__ == <span style="color: rgb(42, 0, 255);">'__main__'</span>:<br />main(sys.argv[0:])</pre></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-766886619510184237.post-3869929776267445082007-09-21T19:59:00.000+03:002007-10-04T13:22:08.966+03:00Htop in FreeBSDI've always loved the top replacement named <a href="http://htop.sourceforge.net/">htop</a> that's available in linux. I usually run my <a href="http://www.gnu.org/software/screen/">screen</a> session with rtorrent, mc and htop opened. I was a bit dissapointed where the usually nitty-gritty method of installing software in FreeBSD (using the ports collection) has failed me when trying to get htop working on my server.<br /> Here is a quick reminder for me (and everyone else for that matter) on how to get htop working on FreeBSD along with the linux compatibility layer.<br /><br /> First you have to dynamically load the linux object in the kernel:<br /><br /> <span style="font-weight: bold;">kldload linux</span><br /><br /> Then we have to make this loading permanent so add <span style="font-style: italic;">linux_enable="YES"</span> to <span style="font-style: italic;">/etc/rc.conf</span>.<br /> <br /> After this, install a linux layer:<br /><br /> <span style="font-weight: bold;">cd /usr/ports/emulators/linux_base-fc4</span> (for some strange reason fc6 is not working for me)<br /> <span style="font-weight: bold;">make install distclean</span><br /><br /> Go to <span style="font-style: italic;">/etc/fstab</span> and add the following line:<br /><br /> <span style="font-weight: bold;">linproc /compat/linux/proc linprocfs rw 0 0</span><br /> <br /> Mount the new filesystem: <span style="font-weight: bold;">mount linproc</span> and go to <span style="font-style: italic;">/usr/ports/sysutils/htop</span> and install as usual.<br /><br /> As soon as I figure out a method of getting a screenshot from my box I will post it :D<br /><br /> Bye for now.Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-766886619510184237.post-52930392712952707232007-09-09T12:21:00.001+03:002007-09-21T19:53:11.791+03:00Thwarting SSH AttacksOh my gosh! These SSH attacks are getting worse by the minute. A few months ago I found that one of my accounts on my desktop was hacked and was sponsoring bandwidth to some IRC bots and abusive scanning. The problem was that I had setup a user with a lame password for a friend of mine so he could get used to the linux command line. Even though I asked him to change the password, he didn't and that resulted in a complaint from a server to my ISP. Having investigated a little I found a huge auth.log with some brute-force attempts at ssh password.<br />Yesterday I started my ssh server on the laptop and because I was very busy I left the laptop running. Today I come home to find a 300K /var/log/auth.log file (which in my opinion - for a freshly installed box with 22h of uptime is a lot). Something had to be done. I hardened my sshd config and searched for something to throttle down the attacks.<br /><br /> <span style="font-weight: bold;">Securing SSH</span><br /><br /> Installing ssh is a breeze. Just type pacman -S openssh, add sshd to your DAEMONS line in /etc/rc.conf.<br /> Now let's take a look at our sshd config and see what we can do to harden our existing installation.<br /> <span style="font-style: italic;">sudo vi /etc/ssh/sshd_config</span><br /><ul><li>Delete the comment before #Port 22 and let's give it something like 2222. </li><li>The protocol should be always set to Protocol 2 because Protocol 1 is insecure</li><li>LoginGraceTime 30</li><li>PermitRootLogin no. Actually it is better to disallow root from the securetty file (more on that later).</li><li>PasswordAuthentification no as you only want people to log in if they have a private key. (more on that subject later)</li><li>Banner /etc/issue.ssh - Put some text in this file - something like: Unauthorized access prohibited. Any activity will be logged.</li></ul>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-766886619510184237.post-42884907098336109452007-09-08T21:47:00.000+03:002007-10-05T13:43:55.257+03:00SSH attacks<div xmlns='http://www.w3.org/1999/xhtml'>Oh my gosh! These SSH attacks are getting worse by the minute. A few months ago I found that one of my accounts on my desktop was hacked and was sponsoring bandwidth to some IRC bots and abusive scanning. The problem was that I had setup a user with a lame password for a friend of mine so he could get used to the linux command line. Even though I asked him to change the password, he didn't and that resulted in a complaint from a server to my ISP. Having investigated a little I found a huge auth.log with some brute-force attempts at ssh password.<br/> Yesterday I started my ssh server on the laptop and because I was very busy I left the laptop running. Today I come home to find a 300K /var/log/auth.log file (which in my opinion - for a freshly installed box with 22h of uptime is a lot). Something had to be done. I hardened my sshd config and searched for something to throttle down the attacks.</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-766886619510184237.post-54165719113980275152007-09-01T09:40:00.000+03:002007-09-01T09:43:39.295+03:00Work in ProgressI'm sorry because I haven't updated this page in a very long time. The truth is I've been very busy going out on vacation and getting ready for my sister's wedding. Now I'm preparing my exams (I have failed several courses ... but that's okay) and after the 12th of September please check my blog out as I'm preparing some hot new stuff. I will be installing qmail on my FreeBSD server, securing it because it must go into production. New articles will pop out soon.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-766886619510184237.post-65866446330757774712007-07-17T21:34:00.000+03:002007-07-21T13:28:27.787+03:00Archlinux setup tutorialToday I am going to write a quick tutorial on installing and getting a working system using <a href="http://www.archlinux.org/">Archlinux</a>. I believe that this is one of the best distributions available, if you are willing to work and start learning something about the fascinating Linux world. As a Slackware user for almost 5 years, I recently switched to Arch because I think that it has some very interesting features that lack in Slack, such as a great package manager and platform specific compiling (it is built for the i686 platform). You get all the nifty features like bleeding-edge packages and standard 2.6 kernel (hehe slack) but you still control the operating system. So, without further ado, let us begin.<br /><br /><span style="font-weight: bold;">Getting the ISOs</span><br /><br />I just grabed a copy from my <a href="ftp://ftp.iasi.roedu.net/mirrors/archlinux.org/iso/2007.05/i686">local mirror</a> and burned it on a CD. I only got the base system iso as it is faster to download and I always get packages through pacman. Leave the CD in the tray and reboot your system. Following the instructions on the screen you should get a command prompt:<br /><br />[Arch Linux: /]#<br /><br /><span style="font-weight: bold;">Partitioning</span><br /><br />I have my hdd already partitioned and I won't get into technical stuff such as partitioning your drive. You get fdisk and cfdisk for that and there are plenty of tutorials available on google for such. Anyway, here is my hdd layout:<br /><br />/dev/sda5 - / - 10GB<br />/dev/sda6 - /boot - 1GB<br />/dev/sda7 - swap - 3GB (I know that it's not necessary to have such a big partition for swap but I also use my box as a server)<br />/dev/sda8 - /usr - 15GB<br />/dev/sda9 - /home - 15GB (you will download por.... ahem ... pro... grams won't you :) )<br /><br /><span style="font-weight: bold;">Basic setup</span><br /><br />Okay. At the prompt just type in /arch/setup and you should be welcomed by a dialog based installation program.<br /><br />1. You are prompted to choose your installation media. I usually (I mean always) go for option 1 - <span style="font-weight: bold;">CD-ROM or OTHER SOURCE<span style="font-weight: bold;"><span style="font-weight: bold;"><span style="font-weight: bold;"><br /></span></span></span></span><br />2. Prepare hard drive<br /><ul><li>I only go for option 3 and assign mount points to my partitions. I choose ext3 for my filesystem although I believe that xfs is better than ext3 (bad habits die hard).</li><li>Be careful that you first have to choose your swap partition.<br /></li></ul>3. Select packages. As I only downloaded the base ISO, guess how many options I have:)<br />4. Install packages - pretty straightforward. I do not choose to keep the packages in cache as I won't have any further use for them.<br />5. Configure system - use nano or vi to your liking (I recommend nano if you want just easy editing)<br /><ul><li>Use hwdetect</li><li>No booting from usb devices (at least in my case)</li><li>No fireware</li><li>No pcmcia devices</li><li>No nfs shares</li><li>No software raid arrays</li><li>No lv2m<br /></li><li>No encrypted volumes</li><li>No custom DSDT files</li><li>/etc/rc.conf - this is your general config file so be careful what you write in it</li></ul><ol><li>Timezone - i change mine to Europe/Bucharest</li><li>MOD_BLACKLIST=(nvidiafb) - I add this since nvidiaframe buffer gives me an error while trying yo compile my nvidia graphic card</li><li>HOSTNAME="something"<br /></li><li>Modify eth0="eth0 ip_address netmask subnet_address broadcast broadcast_address"</li><li>Modify gateway with your default gateway and be sure to delete the preceding ! on ROUTES=(!gateway) as this disables the gateway (nasty)</li></ol><ul><li>hosts - add your host that you put in the HOSTNAME variable in /etc/rc.conf (above)</li><li>/etc/resolv.conf - add your nameservers or you can just <a href="http://www.opendns.com/">opendns</a></li><li>locale-gen - uncomment the line with en_US.UTF-8</li><li>Set the root password</li><li>Choose the mirror closest to you</li></ul>6. Install the kernel - you only have one option here too<br />7. GRUB is okay for me - but I have to uncomment the Windows lines :-S... sorry guys ... hem... not me :)<br /><br />Now go ahead and reboot. All should be fine.<br /><br /><span style="font-weight: bold;">Adding a user</span><br /><br />Just type <span style="font-weight: bold;">adduser</span> at the command prompt and follow the instructions on the screen. Please be advised that I use a sudo environment and as such, a good password for the username is necessary.<br /><br /><span style="font-weight: bold;">Upgrading the system<br /><br /><span style="font-weight: bold;"><span style="font-weight: bold;"><span style="font-weight: bold;"></span></span></span></span>just run<span style="font-weight: bold;"> pacman -Syu </span>at the command prompt. It will take a while (not that much really because there aren't so many packages installed yet).<br /><br /><span style="font-weight: bold;"><span style="font-weight: bold;"><span style="font-weight: bold;"><span style="font-weight: bold;"></span></span></span>Sudo environment<br /><br /><span style="font-weight: bold;"></span></span>As I believe that the Ubuntu philosophy regarding using sudo is very good, on all my systems I get sudo up and running. Here is how:<br /><br /><span style="font-weight: bold;">pacman -S sudo<br /><span style="font-weight: bold;"><span style="font-weight: bold;"><span style="font-weight: bold;"></span></span></span></span>Run <span style="font-weight: bold;">visudo </span>after that and just below <span style="color: rgb(102, 102, 204);">root ALL=(ALL)</span> ALL add <span style="color: rgb(204, 0, 0);">user ALL=(ALL) ALL. <span style="color: rgb(0, 0, 0);">Be careful please as this implies that the specified user will have all the privileges root has.<br /><br /><span style="font-weight: bold;">Xorg setup</span><br /><br />It is as simple as<br /><br /><span style="font-weight: bold;">sudo pacman -S xorg<br /></span><br />After that all you need to do is generate an /etc/X11/xorg.conf. I like the nvidia setup tool for Xorg so <span style="font-weight: bold;"></span>let's go ahead and install some proprietary drivers.<br /><br /><span style="font-weight: bold;">sudo pacman -S nvidia</span><br /><span style="font-weight: bold;">sudo nvidia-xconfig<br /><span style="font-weight: bold;"><span style="font-weight: bold;">cp /etc/skel/.xinitrc ~<br /><br /><span style="font-weight: bold;"></span></span></span></span>Now let's edit the xinitrc file and delete the comment before <span style="font-style: italic;">exec startkde</span> (as we will be using kde).<br /><br /><span style="font-weight: bold;"><span style="font-weight: bold;"><span style="font-weight: bold;"><span style="font-weight: bold;"></span>KDEMOD<br /><br /></span></span></span>Kdemod is a modular and patched version of KDE for Archlinux. It's really great. All you need to do is to edit the pacman file:<br /><br />sudo vi /etc/pacman.conf<br /></span></span>Add at the end<br /><span style="color: rgb(204, 0, 0);"> </span><b style="color: rgb(204, 0, 0);">[kdemod]<br /></b><span style="color: rgb(204, 0, 0);"> </span><b style="color: rgb(204, 0, 0);">Server = http://kdemod.ath.cx/repo/current/i686</b><span style="font-weight: bold;"><span style="font-weight: bold;"></span><br />sudo pacman -Syu</span> to get the list for the kdemod repository<br /><span style="font-weight: bold;"><span style="font-weight: bold;"></span>sudo pacman -S kdemod </span>- go get a cup of coffee or something as this surely takes a while<br /><span style="color: rgb(0, 0, 0); font-weight: bold;">sudo pacman -S kdemod-kdebase-kickoff</span><br /><span style="color: rgb(0, 0, 0); font-weight: bold;">sudo pacman -S kdemod-kdebindings</span><br /><span style="color: rgb(0, 0, 0); font-weight: bold;">sudo pacman -Rd libbeagle</span><br /><span style="color: rgb(0, 0, 0); font-weight: bold;">sudo pacman -S kdemod-kerry</span><br /><span style="color: rgb(0, 0, 0); font-weight: bold;">sudo pacman -S kdemod-beagle</span><br /><span style="color: rgb(0, 0, 0); font-weight: bold;">sudo pacman -S kdemod-applets kdemod-tools</span><br /><span style="color: rgb(0, 0, 0); font-weight: bold;">sudo pacman -S kdemod-kdeutils-kcalc kdemod-kdeadmin</span><br /><span style="font-weight: bold;">sudo /opt/kde/bin/apply_kdemod_theme<br /><br /><br /></span><span style="font-weight: bold;">Accessing your NTFS partition</span><br /><br />Okay guys I'm guilty. I do have some ntfs partitions on my desktop. Here is how to access them:<br /><br /><span style="font-weight: bold;">sudo pacman -S ntfs-3g</span><br /><span style="font-weight: bold;">sudo modprobe fuse</span><br />Add fuse to your /etc/rc.conf MODULES part<br />Edit your /etc/fstab file<br />Add the line:<br /><span style="font-weight: bold; color: rgb(204, 0, 0);">/dev/sda1 /mnt/sda1 ntfs-3g defaults 0 0</span><br />And then let's remount all the drives (but be sure to create /mnt/sda1 first)<br />You now have read-write access to your ntfs drives.<br /><br /><span style="font-weight: bold;">Let's listen to some music</span><br /><br />sudo pacman -S alsa-utils alsa-lib alsa-oss<br />sudo alsaconf<br />sudo alsamixer<br />sudo alsactl store<br />gpasswd -a user audio<br /><br />Also be sure to add <span style="font-style: italic;">alsa</span> to the DAEMONS line in /etc/rc.conf (you have to edit it as root).<br /><br /><span style="font-weight: bold;">Tips and tricks</span><br /><br /><ul><li>Let users use usb sticks</li></ul>gpasswd -a user storage<br />gpasswd -a user optical<br /><ul><li>Settings for firefox:<br /></li></ul>Proportional: Serif 16<br />Serif: Times New Roman<br />Sans: Arial<br />Monospace: Courier New 13<br />Minimum font size: 13<br /><ul><li>Settings for KDE</li></ul>Go to Control Center. Replace color with cleanstick-black-font (you can find it on <a href="http://kde-look.org/">kde-look.org)</a>. Replace style and Window Decorations with Plastik.<br /><br /><ul><li>Add hal to DAEMONS in /etc/rc.conf<br /></li></ul><br /><span style="font-weight: bold;">Software ( great stuff to install )</span><br /><br />sudo pacman -S firefox<br />sudo pacman -S ttf-msfonts ttf-cheapskate artwiz-fonts<br />sudo pacman -S amarok-base<br />sudo pacman -S rtorrent<br />sudo pacman -S acroread<br />sudo pacman -S jre<br />sudo pacman -S openoffice-base<br />sudo pacman -S screen<br />sudo pacman -S smplayer<br />sudo pacman -S flashplugin<br />sudo pacman -S pidgin<br /><br />Well that's about it for tonight. Tomorrow we take a look at some of the config files for different programs. Yes I admit most of this stuff you could find on the Archlinux Wiki but I thought that bringing all of these together combined with my own experience of using Archlinux could be somewhat interesting.Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-766886619510184237.post-14376545298110484642007-07-08T12:09:00.000+03:002007-07-08T17:55:29.206+03:00Very basic FAMP (Freebsd, Apache, MySQL, PHP)As you may already know, <a href="http://daemon80.blogspot.com/2007/07/freebsd-62.html">I installed FreeBSD 6.2</a> last night. One of the primary uses of my machine is a web server complete with PHP and MySQL.<br /><br />Installation is pretty straight-forward.<br /><br /><span style="font-weight: bold;">Apache 2.2</span><br /><br /><div style="background: rgb(224, 224, 224) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><br /><span style="font-family:courier new;">cd /usr/ports/www/apache22</span><br /><span style="color: rgb(0, 204, 204);font-family:courier new;" ><span style="color: rgb(102, 102, 204);"># If you don't know where it is just do a make search name=apache22</span></span><br /><span style="font-family:courier new;">make install clean</span><br /><span style="font-family:courier new;">mkdir -p /var/www/htdocs</span><br /><span style="font-family:courier new;">chgrp -R www /var/www/htdocs</span><br /><span style="font-family:courier new;">chown -R www /var/www/htdocs</span><br /><span style="color: rgb(102, 102, 204);font-family:courier new;" ># Let anybody in the group add new documents</span><br /><span style="font-family:courier new;">chmod g+w -R /var/www/htdocs</span><br /><span style="color: rgb(102, 102, 204);font-family:courier new;" ># Add myself to the www group</span><br /><span style="font-family:courier new;">pw user mod my_user -G www</span><br /><span style="color: rgb(102, 102, 204);font-family:courier new;" ># Let's configure the damn thing</span><br /><span style="font-family:courier new;">vi /usr/local/etc/apache22/httpd.conf</span><br /><span style="color: rgb(102, 102, 204);font-family:courier new;" ># Changed DocumentRoot to /var/www/htdocs<br /># Changed ServerName to http://my_private_adress:80<br /></span><span style="color: rgb(102, 102, 204);font-family:courier new;" ># Changed ServerAdmin to my email address</span><br /><span style="color: rgb(102, 102, 204);font-family:courier new;" ># Changed </span><directory style="font-family:courier new;"><directory var="" www="" htdocs=""><span style="color: rgb(102, 102, 204);">AllowOverride All (as</span><br /><span style="color: rgb(102, 102, 204);"># anybody can modify their directories with .htaccess)<br /># Now let's start it<br /><span style="color: rgb(0, 0, 0);">/usr/local/sbin/apachectl start</span><br /># And add it to /etc/rc.conf to start automatically on every<br /># system boot.</span></directory></directory><br /><span style="font-family:courier new;">echo 'apache22_enable="YES"' >> /etc/rc.conf<br /></span><span style="font-family:courier new;"><br /></span></div><br /><br /><span style="font-weight: bold;">MySQL 5.1</span><br /><br /><div style="background: rgb(224, 224, 224) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><br /><span style="font-family:courier new;">cd /usr/ports/databases/mysql51-server</span><br /><span style="font-family:courier new;">make install clean</span><br /><span style="font-family:courier new;">rehash</span><br /><span style="color: rgb(102, 102, 204);font-family:courier new;" ># Let us start the database installer</span><br /><span style="font-family:courier new;">mysql_install_db --user=mysql</span><br /><span style="font-family:courier new;">chown -R mysql /var/db/mysql/</span><br /><span style="font-family:courier new;">chgrp -R mysql /var/db/mysql/</span><br /><span style="font-family:courier new;">/usr/local/bin/mysqld_safe -user=mysql &</span><br /><span style="color: rgb(102, 102, 204);font-family:courier new;" ># Start it every time the system starts</span><br /><span style="font-family:courier new;">echo ‘mysql_enable=”YES”‘ >> /etc/ rc.conf</span><br /><span style="color: rgb(102, 102, 204);font-family:courier new;" ># Change the root password</span><br /><span style="font-family:courier new;">mysqladmin -u root password newpassword</span><br /><span style="color: rgb(102, 102, 204);font-family:courier new;" ># Copy the config file</span><br /><span style="font-family:courier new;">cp /usr/local/share/mysql/my-small.cnf /var/db/mysql/my.cnf</span><br /><span style="color: rgb(102, 102, 204);font-family:courier new;" ># Add another user (it's generally not a good idea to work with<br /># root)</span><br /><span style="font-family:courier new;">mysql -u root -pnewpassword</span><br /><span style="font-family:courier new;">mysql> GRANT ALL PRIVILEGES ON *.* to 'user'@'localhost' IDENTIFIED BY 'another_password'</span><br /><span style="font-family:courier new;">mysql> quit</span><br /><br /></div><br /><br /><span style="font-weight: bold;">PHP 5.2</span><br /><br /><div style="background: rgb(224, 224, 224) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><br /><span style="font-family: courier new;">cd /usr/ports/lang/php5</span><br /><span style="font-family: courier new;">make install clean</span><br /><span style="font-family: courier new; color: rgb(153, 153, 255);"># You have to choose the option for Apache 2.2</span><br /><span style="font-family: courier new;">cd /usr/ports/lang/php5-extentions</span><br /><span style="font-family: courier new;">make config</span><br /><span style="font-family: courier new; color: rgb(153, 153, 255);"># Choose Mysql, GD, Zlib, PDF, Mbstring and any other extension you would like</span><br /><span style="font-family: courier new;">make install clean</span><br /><span style="font-family: courier new; color: rgb(153, 153, 255);"># Apache configuration</span><br /><span style="font-family: courier new; color: rgb(153, 153, 255);"># After all the LoadModule lines add:</span><br /><span style="font-family: courier new;">AddType application/x-httpd-php .php</span><br /><span style="font-family: courier new;">AddType application/x-httpd-php-source .phps</span><br /><span style="font-family: courier new;">DirectoryIndex index.html index.php</span><br /><span style="font-family: courier new; color: rgb(153, 153, 255);"># Uncomment the Include etc/apache22/extra/httpd-userdir.conf line</span><br /><span style="font-family: courier new; color: rgb(153, 153, 255);"># You now have a per-user web account in /home/user/public_html</span><br /><span style="font-family: courier new; color: rgb(153, 153, 255);"># Restart apache</span><br /><span style="font-family: courier new;">apachectl restart</span><br /><br /></div><br /><br />All is done. Have fun. By the way, you can copy stuff from the outside with scp (you did remember to let ssh connection didn't you?)Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-766886619510184237.post-65433097261166315932007-07-08T10:57:00.000+03:002007-07-08T12:06:09.543+03:00FreeBSD 6.2Although I had FreeBSD 5.2 i decided to install the new version FreeBSD 6. I wanted a clean install (as I really didn't have any important stuff on my server and I had a lot of time to spare). I downloaded the first cd off <a href="ftp://ftp.ro.freebsd.org/pub/FreeBSD/ISO-IMAGES-i386/6.2">ftp.ro.freebsd.org<br /></a> and started the sysinstall utility. I chose a standard instalation with auto partitioning of my 34GB drive (as the 17GB one I'm saving for the Document Root of the webserver and for the /home directories). The installation crippled when copying GENERIC (maybe the media was faulty) and because I didn't have any other blank CDs in my room I decided to try the FTP install. What do you know! I changed the network card on my server and the guys from my ISP make MAC-based authentification. Oh no! What am I supposed to do? Maybe this is just not my night for installing FreeBSD. I luckly found somebody from my ISP online (it was almost 1 AM) and requested my MAC address from their database. I went to the Fixit menu and made a emergency shell on tty4. Yupee! Who knows, maybe I will get lucky after all.<br /><br /><div style="background: rgb(204, 204, 204) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><br /># ifconfig fxp1 ether 00:00:00:00:00:00 <- (my real MAC here)<br /><br /> </div><br />(Don't you just hate the way freebsd sees your devices?)<br /><br />As FreeBSD doesn't require to take down the interface for changing MAC address I jumped to my instalation screen (Alt+F1 btw), entered my IP configuration and from then on everything went smoothly. I no time I was sitting in front of a command prompt.<br /><br /><div style="background: rgb(204, 204, 204) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><br />#<br /><br /></div><br />Pretty ugly since I am used to my bash shell with auto-completion and pwd. This could be fixed in no time:<br /><br /><br /><div style="background: rgb(204, 204, 204) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><br /># pkg_add -r bash<br /># chsh -s bash<br /># bash<br /><br /></div><br />Ah, much better now. The next step was to install some dearly applications to me: <a href="http://www.gratisoft.us/sudo/">sudo</a> and <a href="http://www.gnu.org/software/screen/">screen.</a> But where are they?<br /><br /><div style="background: rgb(204, 204, 204) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><br /># cd /usr/ports<br /># make search name=sudo<br />Path /usr/ports/security/sudo<br />#make search name=screen<br />Path: /usr/ports/sysutils/screen<br /># cd /usr/ports/security/sudo<br /># make install clean<br /># visudo<br />Added user ALL=(ALL) ALL after root<br /># cd /usr/ports/sysutils/screen<br /># make install clean<br /><br /></div><br />That was it. Beautiful and simple.<br /><br />I then logged out of my machine and entered as my user. Sudo is really beautiful. I started to get the hang of it while I was testing Ubuntu and I consider it a really neat ideea. Screen is just one of those app that you can't live without while running a headless server over ssh. Maybe I will come back with a tutorial on screen in a future post.<br /><br />FreeBSD is just simple and neat. Although I never tested it as a desktop operating systems, I always found it as a very nifty OS for servers. I will come back later with some more tutorials on other things I did since install.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-766886619510184237.post-17744031100342536852007-07-03T23:19:00.000+03:002007-07-03T23:37:59.326+03:00Slackware 12A aparut <a href="http://www.slackware.com">Slackware 12</a>. Primele noutati pe care le-am vazut ar fi un kernel default din branch-ul 2.6 (mai precis 2.6.21.5) - ultimul conform <a href="http://www.kernel.org/">kernel.org</a>, KDE 3.5.7, XFCE 4.4.1, HAL (o adaugire mai mult decat asteptata intrucat dbus si hal sunt absolut indispensabile in folosinta cea de toate zilele in KDE) si udev. Din pacate, inca nu exista un packet manager decent, rapid, stabil si oficial (in stable si nu in extra). Desigur exista swaret si slackpkg dar sunt cu cativa ani in spatele portage, aptitude sau chiar pacman .<br /><br />Din cate vad, Slackware in sfarsit vine cu pachete la zi (de la kernel pana la browser sau suita office) dar in fata unor distributii ca ArchLinux (destinat utilizatorilor mai "copti" in ale Linuxului) sau Ubuntu (destinat incepatorilor) incepe sa-si piarda din savoare. Da! Recunosc, Slackware este inca dupa parerea mea printre cele mai bune distributii, dar pur si simplu nu mai am timp pentru a sta sa compilez si sa bibilesc sistemul pentru a-l aduce la o forma cat mai apropiata de gustul meu.<br /><br />Ca parte buna, nu pot sa nu remarc timpul scurt de aparitie al versiunii cu numarul 12. Dupa ce versiunea 11 am asteptat-o cu infrigurare in suflet peste 2 ani, in sfarsit lucrurile s-au miscat mai repede, poate si datorita faptului ca acum distributiile sunt semnate "Pat and the Team".<br /><br />Incercati-l de aici:<br /><a href="ftp://ftp.evolva.ro/linux/slackware/slackware-current-iso/">ftp://ftp.evolva.ro/linux/slackware/slackware-current-iso/</a><br /><br />O sa-l il testez in curand si o sa revin cu niste "food for thought" dar pana una alta cred ca am gasit distributia <a href="http://www.archlinux.org">mea de suflet</a>.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-766886619510184237.post-81121074555448027142007-06-24T11:59:00.000+03:002007-06-24T12:52:49.329+03:00ToolBox part IIPrograme absolut indispensabile:<br /><br /><ul><li><a href="http://www.getfirefox.com/">Firefox</a> cu urmatoarele extensii:</li></ul><ol><li><a href="https://addons.mozilla.org/en-US/firefox/addon/398">ForecastFox</a> (util pentru cei care stau intr-un bunker si vor sa vada vremea de afara)</li><li><a href="https://addons.mozilla.org/en-US/firefox/addon/138">StumbleUpon</a> (am crezut ca-i inutil dar pana la urma m-am convins, l-am instalat si am inceput sa fiu dependent)</li><li><a href="https://addons.mozilla.org/en-US/firefox/addon/1433">Extended Statusbar</a> (o ramasita de cand foloseam opera)</li><li><a href="https://addons.mozilla.org/en-US/firefox/addon/1843">FireBug</a> (as baga-o obligatoriu in programa scoalara de invatat pe dinafara, really cool stuff)</li><li><a href="https://addons.mozilla.org/en-US/firefox/addon/2448">Firefox Google Bookmarks </a>(o modalitate de a-ti tine linkurile intr-o ordine desavarsita - nu-l folosesc niciodata ci pur si simplu arunc linkurile in bookmarks ... asteptand sa-mi intre in rutina zilnica folosirea lui).</li></ol><ul><li><a href="http://www.vim.org/">VIM</a> - the best editor around - programare Python, Java, C, fisiere de configurare. O sa revin cu o lista de pluginuri. Pana atunci:<a href="http://amix.dk/"> amix.dk</a></li><li><a href="http://mplayerhq.hu/">Mplayer</a> - cel mai tare video player</li><li><a href="http://pidgin.im/">Pidgin</a></li><li><a href="http://libtorrent.rakshasa.no/">rTorrent</a></li><li><a href="http://www.gnu.org/software/screen/">Screen</a></li><li><a href="http://www.openoffice.org/">OpenOffice</a></li><li><a href="http://amarok.kde.org/">Amarok</a><span style="text-decoration: underline;"> </span>- am crezut ca e bloated, ca nu e ca winamp etc... dar are niste functii atat de interesante incat dupa ce-l folosesti cateva zile te indragostesti de el (printre care - global shortcuts, lyrics, collection)</li></ul>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-766886619510184237.post-76216748261220378022007-06-24T11:39:00.001+03:002007-06-24T11:58:06.299+03:00ToolBoxIata si hardwareul pe care imi pierd ziua.<br /><br />Un calculator uzat moral si tehnic pe post de desktop si proptea de picioare :)<br /><ul><li>AMD Athlon XP 2000+ (as fi vrut eu Intel)</li><li>Placa Epox 8rda3+ (de asta eram chiar mandru)<br /></li><li>Geforce FX5200 128MB, 64biti</li><li>1GB RAM 333MHz (cersiti de pe la diversi, un ghiveci)<br /></li><li>2x160GB HDD depasiti de lacomia mea de a downloada diverse lucruri inutile si a uita sa le sterg (un Seagate si un Western am impresia)</li><li>Un monitor strident SyncMaster 753s CRT care vine insotit de dureri mari de cap :)</li><li>Boxe Logitech X530 (mersi baieti ... pacat ca voi v-ati luat monitor de restul de bani)<br /></li><li>Distributie: <a href="http://www.archlinux.org">ArchLinux Duke<br /></a></li><li>WM: <a href="http://kdemod.ath.cx">Kdemod</a> (KDE on steroids)</li></ul>Un laptop Fujitsu-Siemens cu mari probleme (pentru ca e FS)<br /><ul><li>Amilo Pro v2065</li><li>Specificatii neimportante gen placavideo, ram, si altele</li><li>Distributie: <a href="http://www.archlinux.org/">ArchLinux Duke<br /> </a></li><li>WM: <a href="http://kdemod.ath.cx/">Kdemod</a> (pur si simplu rocks!)<br /></li><li>nu-mi place pentru ca se strica des, are materiale proaste si i-am mai facut si o gaura in panelul LCD din cauza manipularii defectuoase (deh ... am uit ca nu facut pentru salahori ca mine)</li></ul>Un server (tot Fujitsu-Siemens) <a href="http://developer.novell.com/yes/65677.htm">Primergy C150</a> vechi dar care imi foloseste si pe post de noptiera<br /><ul><li>320 SDRAM ECC</li><li>17GB HDD SCSI</li><li>34GB HDD SCSI</li><li>Procesor Intel Pentium 4 2GHz</li><li>Placa video ATI Radeon (o minune pentru snake in consola)</li><li>Un monitor de 15" (folosit rar la configurari)</li><li>Sistem de operare: <a href="http://www.freebsd.org/">FreeBSD 6.2</a><br /></li><li>Are rol de web server, firewall, ftp server, nas, mysql server etc</li></ul>Astept un KVM, un router wireles WRT54GL si orice alta bucatica de tehnologie oricat de veche care imi vor face ochii sa sclipeasca.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-766886619510184237.post-29781851043550318192007-06-24T11:13:00.000+03:002007-06-24T11:19:27.568+03:00RecordMyDesktop<span style="font-family:georgia;">Am gasit un mic utilitar pentru a captura ecranul in format ogg.<br />Se numeste <a href="http://recordmydesktop.sourceforge.net/">recordmydesktop</a> si pana acum mi se pare foarte usor de folosit, creand capturi de dimensiuni mici (aprox 2MB pentru un minut). Cu toate astea, am senzatia de captura prea rapida totul miscandu-se foarte repede.<br /></span><span style="font-family:georgia;"><br />Desi se gaseste si in ArchLinux repository am preferat sa-l compilez din surse.<br />Cum se foloseste:<br />recordmydesktop -fps 30 -o test.ogg<br /><br /><br /></span>Unknownnoreply@blogger.com1