<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-29178799</id><updated>2012-01-21T12:37:18.030-08:00</updated><title type='text'>Hacking Linux Kernel</title><subtitle type='html'>My Experiences with Linux Kernel Hacks</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>35</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-29178799.post-4486934447632495763</id><published>2010-02-02T01:39:00.000-08:00</published><updated>2010-02-02T02:07:00.029-08:00</updated><title type='text'>Modifying Bootup Scripts in initrd</title><content type='html'>&lt;pre&gt;Unpack it&lt;br /&gt;--------&lt;br /&gt;gunzip -c /minirt | cpio -idm&lt;br /&gt;&lt;br /&gt;OR&lt;br /&gt;&gt;&gt;mv minirt minirt.gz&lt;br /&gt;&gt;&gt;gzip -d minirt.gz&lt;br /&gt;&lt;code class="plain plain"&gt;&gt;&gt;cpio -i &lt; .minirt&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;modify initrc or init&lt;br /&gt;&lt;br /&gt;Pack it back&lt;br /&gt;------------&lt;br /&gt;&lt;code class="plain plain"&gt;find | cpio -H newc -o &gt; ../new_initrd_file&lt;/code&gt;&lt;br /&gt;&lt;code class="plain plain"&gt;gzip -9 new_initrd_file&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-4486934447632495763?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/4486934447632495763/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=4486934447632495763&amp;isPopup=true' title='13 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/4486934447632495763'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/4486934447632495763'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2010/02/modifying-bootup-scripts-in-initrd.html' title='Modifying Bootup Scripts in initrd'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>13</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-7296375167239275536</id><published>2009-06-27T22:04:00.000-07:00</published><updated>2009-06-27T22:09:00.913-07:00</updated><title type='text'>Embedding Type 1 Fonts in Latex Generated PDFs</title><content type='html'>modify file&lt;br /&gt;/usr/share/gs-afpl/8.14/lib/gs_pdfwr.ps&lt;br /&gt;and change lines&lt;br /&gt;&lt;br /&gt;/.standardfonts [&lt;br /&gt;/Courier /Courier-Bold /Courier-Oblique /Courier-BoldOblique&lt;br /&gt;/Helvetica /Helvetica-Bold /Helvetica-Oblique /Helvetica-BoldOblique&lt;br /&gt;/Times-Roman /Times-Bold /Times-Italic /Times-BoldItalic&lt;br /&gt;/Symbol /ZapfDingbats&lt;br /&gt;] readonly def&lt;br /&gt;&lt;br /&gt;into&lt;br /&gt;&lt;br /&gt;/.standardfonts [&lt;br /&gt;% /Courier /Courier-Bold /Courier-Oblique /Courier-BoldOblique&lt;br /&gt;% /Helvetica /Helvetica-Bold /Helvetica-Oblique /Helvetica-BoldOblique&lt;br /&gt;% /Times-Roman /Times-Bold /Times-Italic /Times-BoldItalic&lt;br /&gt;% /Symbol /ZapfDingbats&lt;br /&gt;] readonly def&lt;br /&gt;&lt;br /&gt;Compile using&lt;br /&gt;&gt;&gt;latex myfile.tex&lt;br /&gt;&lt;br /&gt;&gt;&gt;dvips -j0 -Ppdf -Pdownload35 -G0 myfile&lt;br /&gt;&lt;br /&gt;&gt;&gt;ps2pdf -dMaxSubsetPct=100 -dCompatibilityLevel=1.4 -dSubsetFonts=true -dEmbedAllFonts=true myfile.ps&lt;br /&gt;&lt;br /&gt;check using&lt;br /&gt;&gt;&gt;pdffonts myfile.pdf&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-7296375167239275536?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/7296375167239275536/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=7296375167239275536&amp;isPopup=true' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/7296375167239275536'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/7296375167239275536'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2009/06/embedding-type-1-fonts-in-latex.html' title='Embedding Type 1 Fonts in Latex Generated PDFs'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-5332183812935618071</id><published>2007-05-29T16:16:00.000-07:00</published><updated>2007-05-29T16:17:27.425-07:00</updated><title type='text'>SELinux Tutorial</title><content type='html'>I have found very few resources for SELinux on the web, which I believe is a idea tool box for the security engineer or for that matter any average Linux user who plans to use programs of the web without examining them for hacks. I have divided up this tutorial into 2 main sections, the first of which describes why SELinux is the coolest security tool ever followed by a detailed tutorial with a running example of getting up and running with it in no time.&lt;br /&gt;&lt;br /&gt;SELinux in a Nutshell&lt;br /&gt;&lt;p&gt; &lt;/p&gt; The Big challenge is to find ways to have secure systems knowing that flawed application software will always exist. SELinux is an implementation of the reference monitor concept, where the operating system isolates passive resources into distinct objects such as files and active entities such as running programs into subjects. The reference monitor mechanism would then validate access between subjects and object by applying a security policy as embodied in a set of access control rules. Access control decisions are based on security attributes associated with each subject and object. The complexity is a direct result of Linux being complex. There is certainly a trade off in providing a system with the granularity to control every single permission for every object class.&lt;br /&gt;&lt;br /&gt;SELinux's MAC vs Linux's DAC&lt;br /&gt;Security-enhanced Linux (SELinux) is an implementation of a mandatory access control mechanism. This mechanism is in the Linux kernel, checking for allowed operations after standard Linux discretionary access controls are checked. Under DAC, ownership of a file object provides potentially risky control over the object. A user can expose a file or directory to a security or confidentiality breach with a misconfigured chmod command and an unexpected propagation of access rights. A process started by that user, such as a CGI script, can do anything it wants to the files owned by the user. A compromised Apache HTTP server can perform any operation on files in the Web group. Malicious or broken software can have root-level access to the entire system, either by running as a root process or using setuid or setgid. In addition under DAC, there are really only two major categories of users, administrators and non-administrators. In order for services and programs to run with any level of elevated privilege, the choices are few and course grained, and typically resolve to just giving full administrator access. Solutions such as ACLs (access control lists) can provide some additional security for allowing non-administrators expanded privileges, but for the most part a root account has complete discretion over the file system. A MAC or non-discretionary access control framework allows you to define permissions for how all processes (subjects) interact with other parts of the system such as files, devices, sockets, ports, and other processes (objects). This is done through an administratively-defined security policy. These processes and objects are controlled through the kernel, and security decisions are made on all available information rather than just user identity. With this model, a process can be granted just the permissions it needs to be functional. This follows the principle of least privilege. Under MAC, for example, users who have exposed their data using chmod are protected by the fact that their data is a kind only associated with user home directories, and confined processes cannot touch those files without permission and purpose written into the policy.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;   &lt;table border="1" bordercolor="#3333ff" cellpadding="3" cellspacing="0"&gt;     &lt;tbody&gt;     &lt;tr&gt;       &lt;td width="50%"&gt;         DAC&lt;br /&gt;      &lt;/td&gt;       &lt;td width="50%"&gt;         MAC&lt;br /&gt;      &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td width="50%"&gt;         Object Owner has full power&lt;br /&gt;      &lt;/td&gt;       &lt;td width="50%"&gt;         Object Owner can have some power&lt;br /&gt;      &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td width="50%"&gt;         Complete trust in users&lt;br /&gt;      &lt;/td&gt;       &lt;td width="50%"&gt;         Only trust in administrators&lt;br /&gt;      &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td width="50%"&gt;         Decisions are based only on user id and object ownerships&lt;br /&gt;      &lt;/td&gt;       &lt;td width="50%"&gt;         Objects and tasks can themselves have IDs&lt;br /&gt;      &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td width="50%"&gt;         Impossible to control data flow&lt;br /&gt;      &lt;/td&gt;       &lt;td width="50%"&gt;         Makes data-flow control possible&lt;br /&gt;      &lt;/td&gt;     &lt;/tr&gt;     &lt;/tbody&gt;   &lt;/table&gt; &lt;/div&gt;&lt;br /&gt;Setting up SE Linux on FC6&lt;br /&gt;&lt;br /&gt;Installing SELinux Development Packages&lt;br /&gt;Usually the 2-CD install of FC6 does not include the development packages for SELinux. So we need to install those first.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$ yum install selinux-policy-devel&lt;br /&gt;$ yum install setools-devel&lt;br /&gt;$ yum install setools-gui&lt;br /&gt;&lt;br /&gt;It is also generally a good idea to install the audit daemon i.e user space tools for 2.6 kernel auditing. We will need this to monitor our generated AVC denial messages.&lt;br /&gt;&lt;br /&gt;$ yum install audit&lt;br /&gt;$ /etc/init.d/auditd start&lt;br /&gt;&lt;br /&gt;Working with the Policy Sources&lt;br /&gt;Ever since FC started supporting modular policies, they have stopped shipping the targeted policy sources with Fedora. However the reference policy sources from Tresys are available for download and much easier to work with. While NSA's original example policy has very strong interdependencies between types and roles and therefore a very tight coupling of policy source modules, the reference policy has well-defined interfaces and no global use of type and other identifiers, In addition it layers all of its modules in 5 main categories of 'admin', 'apps', 'kernel', 'services' and 'system'.&lt;br /&gt;&lt;br /&gt;The refpolicy at the time of writing this tutorial could be downloaded from  http://oss.tresys.com/projects/refpolicy/wiki/DownloadRelease. After download run&lt;br /&gt;&lt;br /&gt;$ make&lt;br /&gt;$ make install-src&lt;br /&gt;$ make install&lt;br /&gt;&lt;br /&gt;The refpolicy will be compiled and installed into /etc/selinux/refpolicy/src/policy&lt;br /&gt;&lt;br /&gt;Writing the Policy&lt;br /&gt;I am going to describe how to write SELinux rules for a Linux Daemon Service particularly the Asterisk Call Server. The steps involved are pretty generic and can be used for any software you are planning to jail with selinux. When you download and install asterisk, take a note of where it installs its binaries, config, log files etc. We will need this knowledge to set up policy rules for it. Once you download and install the software try running it without selinux support; you can do this by typing&lt;br /&gt;&lt;br /&gt;$ setenforce 0&lt;br /&gt;$ /etc/init.d/asterisk start&lt;br /&gt;&lt;br /&gt;This will switch selinux into permissive mode in which access checks still occur, but instead of denying unallowed access, it simply audits them. Now that we are certain that our daemon runs perfectly we are ready to write selinux policy files for it. Here is a listing of my asterisk.te (the main policy rules) file. I have commented each line in the listing to make it easier to understand.&lt;br /&gt;&lt;br /&gt;asterisk.te&lt;br /&gt;####################&lt;br /&gt;policy_module(asterisk, 1.0)&lt;br /&gt;####################&lt;br /&gt;#&lt;br /&gt;#  Type declarations&lt;br /&gt;#&lt;br /&gt;#  asterisk domain&lt;br /&gt;type asterisk_t;&lt;br /&gt;&lt;br /&gt;# asterisk entrypoint&lt;br /&gt;type asterisk_exec_t;&lt;br /&gt;&lt;br /&gt;#mark asterisk_t as a domain and asterisk_exec_t&lt;br /&gt;#as an entry point into that domain&lt;br /&gt;init_daemon_domain(asterisk_t, asterisk_exec_t)&lt;br /&gt;&lt;br /&gt;# PID file /var/run/asterisk.pid&lt;br /&gt;type asterisk_var_run_t;&lt;br /&gt;files_pid_file(asterisk_var_run_t)&lt;br /&gt;&lt;br /&gt;#configuration files&lt;br /&gt;type asterisk_conf_t;&lt;br /&gt;files_config_file(asterisk_conf_t)&lt;br /&gt;&lt;br /&gt;#log files&lt;br /&gt;type asterisk_log_t;&lt;br /&gt;logging_log_file(asterisk_log_t)&lt;br /&gt;&lt;br /&gt;#files and directories under /var/lib/asterisk&lt;br /&gt;type asterisk_var_lib_t;&lt;br /&gt;files_type(asterisk_var_lib_t)&lt;br /&gt;&lt;br /&gt;# Log files - create, read, and append&lt;br /&gt;allow asterisk_t asterisk_log_t : dir ra_dir_perms;&lt;br /&gt;allow asterisk_t asterisk_log_t : file { create ra_file_perms };&lt;br /&gt;logging_log_filetrans(asterisk_t, asterisk_log_t, file)&lt;br /&gt;logging_search_logs(asterisk_t)&lt;br /&gt;&lt;br /&gt;# configuration files - read&lt;br /&gt;allow asterisk_t asterisk_conf_t : dir r_dir_perms;&lt;br /&gt;allow asterisk_t asterisk_conf_t : file r_file_perms;&lt;br /&gt;allow asterisk_t asterisk_conf_t : lnk_file { getattr read };&lt;br /&gt;&lt;br /&gt;# PID file - create, read, and write&lt;br /&gt;allow asterisk_t asterisk_var_run_t : dir rw_dir_perms;&lt;br /&gt;allow asterisk_t asterisk_var_run_t : file create_file_perms;&lt;br /&gt;files_pid_filetrans(asterisk_t, asterisk_var_run_t, file)&lt;br /&gt;&lt;br /&gt;# /var/lib/asterisk files/dirs - create, read, write&lt;br /&gt;allow asterisk_t asterisk_var_lib_t : dir create_dir_perms;&lt;br /&gt;allow asterisk_t asterisk_var_lib_t : file create_file_perms;&lt;br /&gt;files_var_lib_filetrans(asterisk_t, asterisk_var_lib_t, file)&lt;br /&gt;files_var_lib_filetrans(asterisk_t, asterisk_var_lib_t, dir)&lt;br /&gt;&lt;br /&gt;# Network Access&lt;br /&gt;allow asterisk_t self : tcp_socket create_stream_socket_perms;&lt;br /&gt;corenet_tcp_sendrecv_all_if(asterisk_t)&lt;br /&gt;corenet_tcp_sendrecv_all_nodes(asterisk_t)&lt;br /&gt;corenet_tcp_sendrecv_all_ports(asterisk_t)&lt;br /&gt;corenet_non_ipsec_sendrecv(asterisk_t)&lt;br /&gt;corenet_tcp_bind_all_nodes(asterisk_t)&lt;br /&gt;corenet_tcp_bind_asterisk_port(asterisk_t)&lt;br /&gt;sysnet_dns_name_resolve(asterisk_t)&lt;br /&gt;&lt;br /&gt;Next we create a labeling policy in the form of file security contexts statements. We make use of the gen_context() template interface macro to handle both MLS/MCS and non MLS/MCS policies from the policy source. This file contains hard-coded listing of the directories for the asterisk daemon. The reader will have to change these paths for the application he is jailing via selinux.&lt;br /&gt;&lt;br /&gt;asterisk.fc&lt;br /&gt;################&lt;br /&gt;#asterisk labeling policy&lt;br /&gt;################&lt;br /&gt;/usr/bin/asterisk -- gen_context(system_u:object_r:asterisk_exec_t, s0)&lt;br /&gt;/etc/asterisk(/.*)?  gen_context(system_u:object_r:asterisk_conf_t, s0)&lt;br /&gt;/var/log/asterisk(/.*)? gen_context(system_u:object_r:asterisk_log_t, s0)&lt;br /&gt;/var/lib/asterisk(/.*)? gen_context(system_u:object_r:asterisk_var_lib_t, s0)&lt;br /&gt;/var/run/asterisk(/.*)? gen_context(system_u:object_r:asterisk_var_run_t, s0)&lt;br /&gt;&lt;br /&gt;Finally the external interfaces file for the daemon declares an interface for reading the log files. This way other domains are allowed access by simply calling this interface.&lt;br /&gt;asterisk.if&lt;br /&gt;################&lt;br /&gt;interface(`asterisk_read_log',`&lt;br /&gt;   gen_require(`&lt;br /&gt;     type asterisk_log_t;&lt;br /&gt;   `)&lt;br /&gt;&lt;br /&gt;  logging_search_logs($1)&lt;br /&gt;  allow $1 asterisk_log_t : dir search_dir_perms;&lt;br /&gt;  allow $1 asterisk_log_t : file r_file_perms;&lt;br /&gt;&lt;br /&gt;The above three files are all the source code we need to write to set up a simple selinux jail for our asterisk server. They should be copied to a separate directory and compiled into a policy package asterisk.pp using make. A generic makefile for compiling loadable modules can be copied over from /usr/share/selinux/devel/&lt;br /&gt;&lt;br /&gt;compiling the policy&lt;br /&gt;$ make&lt;br /&gt;&lt;br /&gt;installing the policy&lt;br /&gt;$ /usr/sbin/semodule -i asterisk.pp&lt;br /&gt;&lt;br /&gt;checking  if the policy was successfully installed&lt;br /&gt;$ /usr/sbin/semodule -l&lt;br /&gt;asterisk   1.0&lt;br /&gt;&lt;br /&gt;relabeling all the files/directories in the file context file&lt;br /&gt;$ restorecon /usr/bin/asterisk&lt;br /&gt;$ restorecon -R /etc/asterisk/  /var/log/asterisk  /var/lib/asterisk&lt;br /&gt;&lt;br /&gt;verifying that the labeling occurred correctly using ls -Z&lt;br /&gt;$ ls -scontext /usr/bin/asterisk  /var/log/asterisk&lt;br /&gt;system_u:object_r:asterisk_exec_t        /usr/bin/asterisk&lt;br /&gt;&lt;br /&gt;/var/log/asterisk:&lt;br /&gt;system_u:object_r:asterisk_log_t          asterisk.log&lt;br /&gt;&lt;br /&gt;start asterisk&lt;br /&gt;$ /etc/init.d/asterisk start&lt;br /&gt;&lt;br /&gt;verify that it is running&lt;br /&gt;$ ps axZ | grep asterisk&lt;br /&gt;&lt;br /&gt;check for AVC denials&lt;br /&gt;$ /usr/bin/audit2allow -i &lt; /var/log/audit/audit.log&lt;br /&gt;&lt;br /&gt;Edit the asterisk.te file to make sure that accesses that we are not permitting are suppressed by adding dontaudit rules and finally restart the asterisk server with selinux set to enforcing&lt;br /&gt;&lt;br /&gt;$ setenforce 1&lt;br /&gt;$ /etc/init.d/asterisk restart&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-5332183812935618071?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/5332183812935618071/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=5332183812935618071&amp;isPopup=true' title='15 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/5332183812935618071'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/5332183812935618071'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2007/05/selinux-tutorial.html' title='SELinux Tutorial'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>15</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-4783162947387216281</id><published>2007-01-08T16:38:00.000-08:00</published><updated>2007-01-08T17:00:12.976-08:00</updated><title type='text'>Setting up a Xen DMZ using NAT and IPTables Filtering</title><content type='html'>Make sure you are using a version of Dom0 with kernel support for IP Tables. See my previous post on compiling Xen from source.&lt;br /&gt;&lt;br /&gt;IP Tables option can be found in the kernel menuconfig configuration under&lt;br /&gt;&lt;p class="system"&gt;Networking ---&gt; Networking options ---&gt; [*] Network packet filtering (replaces ipchains) ---&gt; Core Netfilter Configuration ---&gt; &lt;*&gt; Netfilter Xtables support (required for ip_tables)&lt;/p&gt; &lt;p class="system"&gt;Networking ---&gt; Networking options ---&gt; [*] Network packet filtering (replaces ipchains) ---&gt; IP: Netfilter Configuration ---&gt; &lt;*&gt; IP tables support (required for filtering/masq/NAT)&lt;/p&gt; Setup the following options in /etc/xen/xend-config.sxp&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;(network-script network-nat)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;(vif-script     vif-nat)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Check (using ifconfig) that vif1.0 in Dom0 has an IP starting 10.0.0.*&lt;br /&gt;&lt;br /&gt;Now edit your VM config file to set private local IP addresses&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;dhcp = "off"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;vif  = [ 'ip=10.0.0.1' ]         &lt;--the IP I want to assign to my VM&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;ip="10.0.0.1"                      &lt;--add the above here again&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;gateway="10.0.0.128"       &lt;-- the internal IP address of my Dom0 vif1.0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;netmask="255.255.255.0"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Similarly once you boot the VM you can update the above settings in /etc/network/interfaces file in DomU&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;auto eth0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;iface eth0 inet static&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;address 10.0.0.1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;netmask 255.255.255.0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;gateway 10.0.0.128&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;At this point you should be able to ping Dom0 and nodes on the internet from DomU and DomU from Dom0. However DomU is not accessible from the internet because of its private IP address. To address this we can create a DMZ where Dom0 forwards packets to DomU using IP Table rules. For instance if we have an SSHd service running in DomU, then we can enable port forwarding in Dom0 using&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;iptables -A PREROUTING -t nat -p tcp -i eth0 --dport 22 -j DNAT --to 10.0.0.1:22&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A remote user who wants to SSH to DomU will simply give the Public IP of Dom0 while connecting via SSH.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-4783162947387216281?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/4783162947387216281/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=4783162947387216281&amp;isPopup=true' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/4783162947387216281'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/4783162947387216281'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2007/01/setting-up-xen-dmz-using-nat-and.html' title='Setting up a Xen DMZ using NAT and IPTables Filtering'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-6123913667574424720</id><published>2007-01-05T16:04:00.000-08:00</published><updated>2007-01-05T16:05:52.707-08:00</updated><title type='text'>Proxy settings for apt-get and wget</title><content type='html'>export http_proxy="http://[address]:[port]/"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-6123913667574424720?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/6123913667574424720/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=6123913667574424720&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/6123913667574424720'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/6123913667574424720'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2007/01/proxy-settings-for-apt-get-and-wget.html' title='Proxy settings for apt-get and wget'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-6719162124198761897</id><published>2006-12-12T19:16:00.000-08:00</published><updated>2006-12-12T19:35:42.491-08:00</updated><title type='text'>What Linux Drivers are being used?</title><content type='html'>While recompiling a custom kernel &lt;b&gt;depmod&lt;/b&gt;  -a creates a "Makefile"-like dependency file, based on the symbols it finds in the set of modules mentioned on the command line or from the directories specified in the configuration file. This dependency file is later used by &lt;b&gt;modprobe&lt;/b&gt;  to automatically load the correct module or stack of modules.&lt;br /&gt;&lt;br /&gt;If you are curious about which drivers are running and their purpose. Here is how to get started&lt;br /&gt;Modules loaded automatically at boot time can be found under /lib/modules/KERNELNAME&lt;br /&gt;&lt;br /&gt;The list of running modules can be found using&lt;br /&gt;&lt;code&gt;lsmod&lt;br /&gt;$ less /proc/modules&lt;br /&gt;&lt;br /&gt;More information about the modules can be found via&lt;br /&gt;&lt;/code&gt;&lt;code&gt;/sbin/modinfo video&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-6719162124198761897?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/6719162124198761897/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=6719162124198761897&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/6719162124198761897'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/6719162124198761897'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/12/what-linux-drivers-are-being-used.html' title='What Linux Drivers are being used?'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-2058136718871193995</id><published>2006-12-08T17:37:00.000-08:00</published><updated>2006-12-08T17:55:07.482-08:00</updated><title type='text'>Total Ram Memory Available</title><content type='html'>free -m&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-2058136718871193995?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/2058136718871193995/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=2058136718871193995&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/2058136718871193995'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/2058136718871193995'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/12/total-ram-memory-available.html' title='Total Ram Memory Available'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-2815209564807336578</id><published>2006-11-21T13:27:00.000-08:00</published><updated>2006-11-21T13:52:26.500-08:00</updated><title type='text'>Setting up your own SMTP and POP3 Mail Server</title><content type='html'>I used SendMail for SMTP and Qpopper for POP3.&lt;br /&gt;&lt;br /&gt;Download and install the sendmail package if you don't have it&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;rpm -qa | grep -i sendmail&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Start it and check if its running&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;/etc/init.d/sendmail start&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;ps aux | grep -i sendmail&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;change into the mail config directory and edit the settings&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;cd /etc/mail&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;add the following to sendmail.mc&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;TRUST_AUTH_MECH('LOGIN PLAIN')dnl&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;define('confAUTH_MECHANISMS', 'LOGIN PLAIN')dnl&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;define('confSMTP_LOGIN_MSG', '$j')dnl&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Comment this line out so Sendmail will listen for remote connections.&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;DAEMON_OPTIONS('Port=smtp,Addr=127.0.0.1, Name=MTA')dnl. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Make the config&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;make -C /etc/mail&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Check firewall settings to allow access to port 25. Also allow access to other systems on domain by adding relays to the following file&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;/etc/mail/access&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;jf.intel.com RELAY&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Compile it&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;makemap hash /etc/mail/access &lt; /etc/mail/access&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Check that there is a service listning on 25 by doing a port scan and try to telnet to it remotely&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;nmap localhost&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;telnet tsrd-rhel4-1 25&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;quit&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Add you domain to&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;cd /etc/mail&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;vi local-host-names&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;intel.com&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Create accounts&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;useradd webmaster&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;passwd webmaster&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;[enter password]&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;[confirm password]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Associate users to their email addresses&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;vi virtusertable&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;webmaster@intel.com webmaster&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Compile&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;makemap -v hash ./virtusertable.db &lt; ./virtusertable&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Restart service&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;/etc/init.d/sendmail restart&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Setting up POP3&lt;br /&gt;Download QPopper and compile it&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;./configure --prefix=/usr --mandir=/usr/share/man&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;make all&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;make install&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Use xinitd to manage it&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;cd /etc/xinetd.d&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;vi qpopper&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;# qpopper POP3 server&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;service pop3&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt; disable  = no&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt; flags  = REUSE&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt; socket_type = stream&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt; wait  = no&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt; user  = root&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt; server  = /usr/sbin/popper&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt; instances = 50&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt; per_source = 10&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt; log_on_failure += USERID&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;restart init.d&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;/etc/init.d/xinetd restart&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;check if the service is running on 110&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;nmap localhost&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Check your mail&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;telnet localhost 110&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;user [account name]&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;pass [account password]&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-2815209564807336578?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/2815209564807336578/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=2815209564807336578&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/2815209564807336578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/2815209564807336578'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/11/setting-up-your-own-smtp-and-pop3-mail.html' title='Setting up your own SMTP and POP3 Mail Server'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-5089991926566873073</id><published>2006-11-17T01:01:00.000-08:00</published><updated>2006-11-17T01:03:11.961-08:00</updated><title type='text'>Checking running Kernel support for a module</title><content type='html'>&lt;pre&gt;For instance this example checks for netfilter support&lt;br /&gt;zgrep -i netfilter /proc/config.gz&lt;br /&gt;CONFIG_NETFILTER=y&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-5089991926566873073?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/5089991926566873073/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=5089991926566873073&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/5089991926566873073'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/5089991926566873073'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/11/checking-running-kernel-support-for.html' title='Checking running Kernel support for a module'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-8989794007573876433</id><published>2006-11-16T17:35:00.000-08:00</published><updated>2007-01-25T14:11:37.666-08:00</updated><title type='text'>Installing Xen 3.0.3 from source on Ubuntu Edgy</title><content type='html'>A step by step tutirial for people getting the most out of their PC with Xen virtualization&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family:times new roman;"&gt;Getting the latest version of Xen&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:85%;" &gt;mkdir /home/xen&lt;br /&gt;wget http://bits.xensource.com/oss-xen/release/3.0.3-0/src.tgz/xen-3.0.3_0-src.tgz&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 153);"&gt;I used xen-3.0.3_0-src.tar from xen source. It contains the folders&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 153);font-family:times new roman;font-size:85%;"  &gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;patches\&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 0, 153);font-family:times new roman;font-size:85%;"  &gt;There are a couple of generic linux patches in patches/ and these can be added to over the course of time.&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;&lt;span style="font-weight: bold; font-style: italic; color: rgb(51, 0, 153);"&gt;linux-2.6-xen-sparse&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 153);"&gt;This is the xen source tree&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;&lt;span style="font-size:130%;"&gt;Adding Packages to system prior to install&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;&lt;span style="font-weight: bold;"&gt;apt-get update&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;apt-get install iproute bridge-utils python-twisted gcc-3.3 binutils make libcurl3-dev zlib1g-dev python-dev transfig bzip2 screen ssh debootstrap libcurl3-dev x-dev xorg-x11-devel libncurses5-dev tetex-base&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;&lt;span style="color: rgb(51, 0, 153);"&gt;&lt;br /&gt;These are the important packages I downloaded after many frustrating attempts at failed makes. &lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;gunzip xen-3.0.3_0-src.tgz&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;tar -xvf xen-3.0.3_0-src.tar&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;Compiling Xen&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Making changes to Makefile and Config.mk prior to install&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;&lt;br /&gt;Add the following options to &lt;span style="font-weight: bold;"&gt;CFLAGS -fno-stack-protector&lt;/span&gt; and &lt;span style="font-weight: bold;"&gt;-mno-tls-direct-seg-refs&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;make world&lt;br /&gt;&lt;br /&gt;make install&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;Folders Created by make world followed by make install&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);font-size:85%;" &gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);font-family:times new roman;font-size:85%;"  &gt;pristine-linux-2.6.16.29 :- &lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);font-family:times new roman;font-size:85%;"  &gt;We will refer to original "untainted" kernel source directory  that comes with the distribution as the pristine kernel sources. Pristine is unmodified reference and has patches applied from the patches/ directory.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);font-family:times new roman;font-size:85%;"  &gt;&lt;span&gt;linux-2.6.16.29-xen[0U]:- &lt;/span&gt;A xenized Linux&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);font-family:times new roman;font-size:85%;"  &gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;dist&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt; &lt;/span&gt;&lt;span&gt;:-&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);font-size:85%;" &gt; Inside dist the &lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);font-size:85%;" &gt;boot&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt; folder contains files to be copied to  /boot,  the  lib/modules/2.6.16.29-xen0 to be copied to /lib/modules and usr/include/xen to be copied to /usr/include&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;br /&gt;Files Created by install.sh&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt;&lt;span style="color: rgb(51, 51, 255);"&gt;The above copying is performed by this script. The important files are&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;1) xen-3.0.3-0.gz is the Xen hypervisor. It is the one that boots the machine in grub config file with label "kernel".It's the lowest layer of software in the system.  You need it but it's not much use on its own - you also need a kernel for domain 0 (usually Linux)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;2) vmlinuz-2.6.16.29-xen is the kernel for domain 0, and should be called by xen-3.0.3-0.gz for starting domain0, with label "module" in the grub config.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;Other than these two there are configuration files and syms (debug) versions of these also created in the boot directory.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;Compiling Dom0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:85%;" &gt;make linux-2.6-xen0-config CONFIGMODE=menuconfig KERNELS="linux-2.6-xen0"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);font-size:85%;" &gt;In the kernel comfiguration menu that shows up we enable quota, iptables, dummy network driver as modules.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:85%;" &gt;make linux-2.6-xen0-build&lt;br /&gt;make linux-2.6-xen0-install&lt;br /&gt;depmod 2.6.16.29-xen0&lt;br /&gt;./install.sh&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);font-size:85%;" &gt;This will copy the Dom0 kernel and the Xen VMM to the boot directory. Now we create the initrd&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:85%;" &gt;&lt;br /&gt;mkinitramfs -o initrd.img-2.6.16.29-xen0 2.6.16.29-xen0&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);font-size:85%;" &gt;Move all xen related files to a separate folder inside boot&lt;/span&gt;&lt;span style="font-weight: bold;font-size:85%;" &gt;&lt;br /&gt;cd /boot&lt;br /&gt;mkdir xen&lt;br /&gt;mv *xen* xen&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family:times new roman;"&gt;Setting up Boot Parameters&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);font-size:85%;" &gt;I added the following entry to my /boot/grub/menu.lst&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-weight: bold;"&gt;title           Xen 3.0, kernel 2.6.16-xen&lt;/span&gt;                                                        &lt;-- Label for boot screen selection  &lt;span style="font-weight: bold;"&gt;&lt;br /&gt;root          (hd0,1)&lt;/span&gt;                                                                                                                                                                                  &lt;--Harddrive and partition where your MBR resides  &lt;span style="font-weight: bold;"&gt;&lt;br /&gt;kernel       /boot/xen/xen-3.gz root=/dev/hda1 dom0_mem=400000  &lt;/span&gt;&lt;--Xen VMM &lt;span style="font-weight: bold;"&gt;module     /boot/vmlinuz-2.6.16.29-xen ro console=tty0&lt;/span&gt;&lt;--Dom0 ker &lt;span style="font-weight: bold;"&gt;&lt;br /&gt;module     /boot/initrd.img-2.6.16.29-xen&lt;/span&gt;                                                                                        &lt;--initrd image.   vmlinuz-2.6.11-9-xenU is the kernel that should be used to boot the other domains, the guests. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;Usually, it is in the /etc/xen/domU config file as "kernel" parameter.  This kernel is a bit smaller than the xen0 kernel but can only run in domUs. You may want to use it in your guests, or you can just use the xen0 kernel everywhere.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family:times new roman;"&gt;Final Checks&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);font-size:85%;" &gt;To improve performance disable TLS&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;&lt;span style="font-weight: bold;"&gt;mv /lib/tls /lib/tls.disabled&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);font-size:85%;" &gt;Make sure that hotplug udevs shortcuts have been created. There should be a softlink to&lt;/span&gt; &lt;span style=";font-family:times new roman;font-size:85%;"  &gt;&lt;span style="font-weight: bold;"&gt;xen-backend.rules&lt;/span&gt;&lt;/span&gt; in &lt;span style="font-weight: bold;font-family:times new roman;font-size:85%;"  &gt;/etc/udev/rules.d&lt;/span&gt;. &lt;span style="color: rgb(51, 51, 255);font-size:85%;" &gt;Make sure it starts with number and not a character.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family:times new roman;"&gt;Reboot Machine into Xen&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Edit /etc/apt/sources.list&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;Uncomment the following lines&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:85%;" &gt;&lt;span style="font-family:times new roman;"&gt;deb http://us.archive.ubuntu.com/ubuntu/ edgy universe&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;deb-src http://us.archive.ubuntu.com/ubuntu/ edgy universe&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;deb http://security.ubuntu.com/ubuntu edgy-security main restricted&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;deb-src http://security.ubuntu.com/ubuntu edgy-security main restricted&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;deb http://security.ubuntu.com/ubuntu edgy-security universe&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;deb-src http://security.ubuntu.com/ubuntu edgy-security universe&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Compile DomU Kernel&lt;br /&gt;&lt;span style="font-weight: bold;font-size:85%;" &gt;&lt;span style="font-family:times new roman;"&gt;cd /home/xen/xen-3.0.3_0-src/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;make linux-2.6-xenU-config CONFIGMODE=menuconfig KERNELS="linux-2.6-xenU"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:85%;" &gt;&lt;span style="font-family:times new roman;"&gt;make linux-2.6-xenU-build&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;  make linux-2.6-xenU-install&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;depmod 2.6.16.29-xenU&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Download, Install and Configure xen-tools&lt;br /&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;&lt;span style="font-weight: bold;"&gt;mkdir /home/xen&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;apt-get update&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;apt-get install xen-tools&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;vim /etc/xen-tools/xen-tools.conf&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;dir = /home/xen&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;debootstrap = 1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;size   = 6Gb      # Disk image size.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;memory = 128Mb    # Memory size&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;swap   = 256Mb    # Swap size&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;fs     = ext3     # use the EXT3 filesystem for the disk image.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;dist   = edgy   # Default distribution to install.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;image  = sparse   # Specify sparse vs. full disk images.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;gateway   = 192.168.1.1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;netmask   = 255.255.255.0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;passwd = 1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;kernel = /boot/vmlinuz-2.6.16.29-xenU&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;initrd = /boot/initrd.img-2.6.16.29-xen0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;mirror = http://ftp.us.debian.org/debian/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;mirror = http://gb.archive.ubuntu.com/ubuntu/&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Make sure Xend is running&lt;br /&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;&lt;span style="font-weight: bold;"&gt;xend start&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Create a new virtual Machine&lt;br /&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;&lt;span style="font-weight: bold;"&gt;xen-create-image --hostname=vmubuntu1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;xm create vmubuntu1.cfg -c&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Network Setup&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;The above xen-tools configuration assigned a static IP address but if you are using dhcp for dom0 you might just want to stick to that for the DomUs.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:times new roman;" &gt;iface eth0 inet dhcp &lt;/span&gt; &lt;-- stick this into your /etc/network/interface file in DomU  &lt;span style="color: rgb(51, 51, 255);"&gt;Make sure that your Dom0's /etc/network/interfaces file is configured correctly because the Xen network scripts pick up the settings from there. I also had to completely get rid of NetworkManager that I was using to manage by Wireless interfaces.&lt;br /&gt;The VM image config file vmubuntu1.cfg should only have the following networking options.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;font-size:85%;" &gt;&lt;span style="font-family:times new roman;"&gt;&lt;br /&gt;dhcp = 'dhcp'&lt;br /&gt;vif = [ ' ' ]&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;br /&gt;Make sure the bridge options are configured in /etc/xen/xend-config.sxp.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:85%;" &gt;&lt;span style="font-family:times new roman;"&gt;(network-script network-bridge)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;(vif-script vif-bridge)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);font-size:85%;" &gt;An ifconfig on Dom0 should show a eth, vif, peth and a xenbr interface. If you don't see these then something broke along the way and you need to try running the networking scripts in /etc/xen/scripts manually and examine the errors. What are all these new interfaces you ask? Well here is how the default bridged networking is supposed to work.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;i&gt;      Domain0 network stack&lt;/i&gt;&lt;br /&gt;&lt;i&gt;                ^^&lt;/i&gt;&lt;br /&gt;&lt;i&gt;                ||&lt;/i&gt;&lt;br /&gt;&lt;i&gt;                ||&lt;/i&gt;&lt;br /&gt;&lt;i&gt;      eth0 [local virtual interface]&lt;/i&gt;&lt;br /&gt;&lt;i&gt;                ^^&lt;/i&gt;&lt;br /&gt;&lt;i&gt;                ||&lt;/i&gt;&lt;br /&gt;&lt;i&gt;                || local traffic intended for domain0&lt;/i&gt;&lt;br /&gt;&lt;i&gt;                ||&lt;/i&gt;&lt;br /&gt;&lt;i&gt;                ||&lt;/i&gt;&lt;br /&gt;&lt;i&gt;xen-br0[bridge]&lt;===&gt; vif0.0 [virtual dom0] &lt;===&gt; eth0 [domU virtual&lt;/i&gt;&lt;i&gt;&lt;span style="font-family:monospace;"&gt; &lt;/span&gt;nic]&lt;/i&gt;&lt;br /&gt;&lt;i&gt;   ||&lt;/i&gt;&lt;br /&gt;&lt;i&gt;   ||&lt;/i&gt;&lt;br /&gt;&lt;i&gt;   || external traffic&lt;/i&gt;&lt;br /&gt;&lt;i&gt;   ||&lt;/i&gt;&lt;br /&gt;&lt;i&gt;   VV&lt;/i&gt;&lt;br /&gt;&lt;i&gt; peth0 [real, physical interface]&lt;/i&gt;&lt;br /&gt;&lt;i&gt;   ||&lt;/i&gt;&lt;br /&gt;&lt;i&gt; --XX ------------ NETWORK -----------------&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/pre&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;If you are not too keen on the default network configuration scripts, it is also easy to set up a bridge yourself&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:85%;" &gt;&lt;span style="font-family:times new roman;"&gt;brctl addbr xenbr0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;brctl stp xenbr0 off&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;brctl sethello xenbr0 0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;brctl setfd xenbr0 0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;ifconfig xenbr0 192.168.1.1 netmask 255.255.255.0 up&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Copy over the library files to the new virtual disk&lt;br /&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;&lt;span style="font-weight: bold;"&gt;mkdir /mnt/vmdisk&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;mount -o loop /home/xen/domains/disk.img /mnt/vmdisk&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;cd /mnt/vmdisk/lib/modules&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;cp -a /lib/modules/2.6.16.29-xenU .&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;umount /mnt/vmdisk/&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Check that the domains running&lt;br /&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;&lt;span style="font-weight: bold;"&gt;xm list&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-8989794007573876433?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/8989794007573876433/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=8989794007573876433&amp;isPopup=true' title='35 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/8989794007573876433'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/8989794007573876433'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/11/installing-xen-303-from-source-on.html' title='Installing Xen 3.0.3 from source on Ubuntu Edgy'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>35</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-4276868212112507149</id><published>2006-11-15T14:41:00.000-08:00</published><updated>2006-11-15T15:33:50.260-08:00</updated><title type='text'>Linux Windows Dual Boot without nuking existing MBR</title><content type='html'>Want to try out a Linux Distribution on your Windows PC without nuking your Windows MBR?&lt;br /&gt;Here is how you go about it.&lt;br /&gt;&lt;br /&gt;Assuming you partition your drive as follows&lt;br /&gt;&lt;ul&gt;&lt;li&gt;grub code (hda0,0), fdisk code /dev/hda1, primary, NTFS, Windows XP: 60 GB  &lt;/li&gt;&lt;li&gt;grub code (hd0,1), fdisk code /dev/hda2, primary, ext3, Ubuntu Linux: 14 GB  &lt;/li&gt;&lt;li&gt;grub code (hd0,2), fdisk code /dev/hda3, extended&lt;br /&gt;&lt;/li&gt;&lt;li&gt;grub code (hd0,3), fdisk code /dev/hda5 Linux Swap: 1 GB (the rule of thumb is twice as large as your  RAM)  &lt;/li&gt;&lt;li&gt; grub code (hd0,4), fdisk code /dev/hda6, FAT16: 5 GB for sharing&lt;/li&gt;&lt;/ul&gt;Install grub on &lt;tt&gt;(hd0,1)&lt;/tt&gt;.  The "0" immediately after "hd" indicates the first hard drive (counting starts at zero instead of one). The "1" after the comma indicates the second primary partition.&lt;br /&gt;&lt;br /&gt;Use QTParted to make the Windows partition active (instead of the Linux partition)&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;mkdir /mnt/shared&lt;/li&gt;&lt;li&gt;mount -t msdos /dev/hda6 /mnt/shared&lt;/li&gt;&lt;li&gt;dd if=/dev/hda2 of=/mnt/shared/ubuntu.bin bs=512 count=1&lt;/li&gt;&lt;li&gt;Reboot into Windows. &lt;/li&gt;&lt;li&gt;Copy &lt;tt&gt;ubuntu.bin&lt;/tt&gt; to &lt;tt&gt;C:\&lt;/tt&gt;&lt;/li&gt;&lt;li&gt;Add C:\ubuntu.bin="Ubuntu Linux" to boot.ini&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-4276868212112507149?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/4276868212112507149/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=4276868212112507149&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/4276868212112507149'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/4276868212112507149'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/11/linux-windows-dual-boot-without-nuking.html' title='Linux Windows Dual Boot without nuking existing MBR'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-2444363143562175474</id><published>2006-11-14T00:06:00.000-08:00</published><updated>2006-11-14T00:14:48.787-08:00</updated><title type='text'>Resolving stack_chk_fail Error</title><content type='html'>Today I moved to the new version of gcc 4.1.2. When trying to compile Xen, it kept giving me a 'stack_chk_fail' symbol not found error.&lt;br /&gt;&lt;br /&gt;Took me 4 hours to figure out that it wasn't a problem with Xen but with my gcc.&lt;br /&gt;Apparently  the new version of gcc emits extra code to check for buffer overflows, such as stack smashing attacks by default whereas my kernel did not support it  and I had been using 2.6.17.10 !&lt;br /&gt;&lt;br /&gt;Anyways resolved the problem by adding &lt;span style="font-style: italic;"&gt;-fno-stack-protector&lt;/span&gt; to the &lt;span style="font-weight: bold;"&gt;CFLAGS&lt;/span&gt; option in the Makefile.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-2444363143562175474?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/2444363143562175474/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=2444363143562175474&amp;isPopup=true' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/2444363143562175474'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/2444363143562175474'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/11/resolving-stackchkfail-error.html' title='Resolving stack_chk_fail Error'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-116318917622733294</id><published>2006-11-10T12:03:00.000-08:00</published><updated>2006-11-13T23:59:16.853-08:00</updated><title type='text'>Root Permissions for Linux Live CD</title><content type='html'>Installing Ubuntu 6.10. Open up a terminal and set your root password first using &lt;span style="font-style:italic;"&gt;sudo passwd root&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-116318917622733294?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/116318917622733294/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=116318917622733294&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/116318917622733294'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/116318917622733294'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/11/root-permissions-for-linux-live-cd.html' title='Root Permissions for Linux Live CD'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-116295010893693766</id><published>2006-11-07T17:40:00.000-08:00</published><updated>2006-11-13T23:59:16.762-08:00</updated><title type='text'>Detailed Recursive Directory Listing</title><content type='html'>Try using the find command &lt;span style="font-style:italic;"&gt;find . -maxdepth 4&lt;br /&gt;&lt;/span&gt; rather than the overused &lt;span style="font-style:italic;"&gt;ls&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-116295010893693766?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/116295010893693766/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=116295010893693766&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/116295010893693766'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/116295010893693766'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/11/detailed-recursive-directory-listing.html' title='Detailed Recursive Directory Listing'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-116250322950867581</id><published>2006-11-02T13:32:00.000-08:00</published><updated>2006-11-13T23:59:16.668-08:00</updated><title type='text'>Redirect stdout to file and screen simultaneously</title><content type='html'>&lt;span style="font-style:italic;"&gt;./a.out | tee trace.txt&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-116250322950867581?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/116250322950867581/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=116250322950867581&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/116250322950867581'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/116250322950867581'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/11/redirect-stdout-to-file-and-screen.html' title='Redirect stdout to file and screen simultaneously'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-116191236713644661</id><published>2006-10-26T18:05:00.000-07:00</published><updated>2006-11-13T23:59:16.533-08:00</updated><title type='text'>Search, Process, Replace strings in a File using Perl</title><content type='html'>I wanted some one-line loop to read a log file containing serial numbers line-by-line, search for a serial using some regular expression, read it into a variable and then mark it as used back into the file so its not used again next time. Here is how it goes&lt;br /&gt;&lt;br /&gt;So the file looks something like this&lt;br /&gt;&lt;br /&gt;EVAL=SomeSerial1              #Created on Fri Oct 13 11:12:09 2006.&lt;br /&gt;COM=SomeSerial2               #Created on Tue Oct 17 11:19:45 2006.&lt;br /&gt;COM=SomeSerial3               #Created on Tue Oct 17 11:19:45 2006.&lt;br /&gt;&lt;br /&gt;#Main &lt;br /&gt;print &amp;getSerialfromFile("./serialnumbers.txt", "COM=");&lt;br /&gt;&lt;br /&gt;sub getSerialfromFile($$)&lt;br /&gt;{&lt;br /&gt;    my $line;&lt;br /&gt;    my ($serials_file, $pattern) = (@_);&lt;br /&gt;    open(MAP, $serials_file) or die "failed to open $serials_file, $!";&lt;br /&gt;    my @lines = &amp;lt; MAP &amp;gt; &lt;br /&gt;    close(MAP);&lt;br /&gt;    foreach $line (@lines)&lt;br /&gt;    {&lt;br /&gt;        next unless ($line =~ s/^$pattern(.*?)\s/used$pattern$1/g) ;&lt;br /&gt;        # You can use the serial $1 here&lt;br /&gt;    }&lt;br /&gt;    open(MAP, "&gt;", "./changed.txt");&lt;br /&gt;    print MAP @lines;&lt;br /&gt;    close(MAP);&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-116191236713644661?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/116191236713644661/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=116191236713644661&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/116191236713644661'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/116191236713644661'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/10/search-process-replace-strings-in-file.html' title='Search, Process, Replace strings in a File using Perl'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-115991103033556736</id><published>2006-10-03T14:21:00.000-07:00</published><updated>2006-11-13T23:59:16.282-08:00</updated><title type='text'>Easy Error Logging in Perl via Log4Perl</title><content type='html'>Need a quick and dirty tutorial on enabling loggers in your scripts? Here you go.&lt;br /&gt;Download and Install  Log-Log4perl-1.06 from CPAN (May prompt you to install IO-Tty-1.07).&lt;br /&gt;&lt;br /&gt;The following perl script will let you give you the ability to define 3 filters for your logging: Error, Warn and Info. Warings and Errors are logged to one file and Info messages to the other.&lt;br /&gt;&lt;br /&gt;use Log::Log4perl qw(get_logger);&lt;br /&gt;&lt;br /&gt;# Define configuration&lt;br /&gt;my $conf = q(&lt;br /&gt; log4perl.logger                    = INFO, AppInfo, AppWarn, AppError&lt;br /&gt; &lt;br /&gt;  #filter to match INFO&lt;br /&gt; log4perl.filter.MatchInfo = Log::Log4perl::Filter::LevelMatch&lt;br /&gt; log4perl.filter.MatchInfo.LevelToMatch = INFO&lt;br /&gt; log4perl.filter.MatchInfo.AcceptOnMatch = true&lt;br /&gt;&lt;br /&gt;  #filter to match Warn&lt;br /&gt; log4perl.filter.MatchWarn = Log::Log4perl::Filter::LevelMatch&lt;br /&gt; log4perl.filter.MatchWarn.LevelToMatch = WARN&lt;br /&gt; log4perl.filter.MatchWarn.AcceptOnMatch = true&lt;br /&gt; &lt;br /&gt; # filter to match Error&lt;br /&gt; log4perl.filter.MatchError = Log::Log4perl::Filter::LevelMatch&lt;br /&gt; log4perl.filter.MatchError.LevelToMatch = ERROR&lt;br /&gt; log4perl.filter.MatchError.AcceptOnMatch = true&lt;br /&gt; &lt;br /&gt;    # Info Appender &lt;br /&gt; log4perl.appender.AppInfo          = Log::Log4perl::Appender::File&lt;br /&gt; log4perl.appender.AppInfo.filename = detail.log&lt;br /&gt; log4perl.appender.AppInfo.layout   = PatternLayout&lt;br /&gt; log4perl.appender.AppInfo.layout.ConversionPattern = %d %p&gt; %F{1}:%L %M - %m%n&lt;br /&gt; log4perl.appender.AppInfo.Filter   = MatchInfo&lt;br /&gt;&lt;br /&gt;   # Warn Appender &lt;br /&gt; log4perl.appender.AppWarn          = Log::Log4perl::Appender::File&lt;br /&gt; log4perl.appender.AppWarn.filename = result.log&lt;br /&gt; log4perl.appender.AppWarn.layout   = PatternLayout&lt;br /&gt; log4perl.appender.AppWarn.Filter   = MatchWarn&lt;br /&gt; &lt;br /&gt; # Error Appender &lt;br /&gt; log4perl.appender.AppError          = Log::Log4perl::Appender::File&lt;br /&gt; log4perl.appender.AppError.filename = detail.log&lt;br /&gt; log4perl.appender.AppError.layout   = PatternLayout&lt;br /&gt; log4perl.appender.AppError.layout.ConversionPattern = %d %p&gt; %F{1}:%L %M - %m%n&lt;br /&gt; log4perl.appender.AppError.Filter   = MatchError&lt;br /&gt;);&lt;br /&gt; &lt;br /&gt;# Initialize logging behaviour&lt;br /&gt;  Log::Log4perl-&gt;init( \$conf );&lt;br /&gt;&lt;br /&gt;my $logger = get_logger("issa::test");&lt;br /&gt;$logger-&gt;info("License file installed successfully");&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-115991103033556736?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/115991103033556736/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=115991103033556736&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/115991103033556736'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/115991103033556736'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/10/easy-error-logging-in-perl-via.html' title='Easy Error Logging in Perl via Log4Perl'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-115956914232171216</id><published>2006-09-29T15:18:00.000-07:00</published><updated>2006-11-13T23:59:16.164-08:00</updated><title type='text'>Setting up CVS client in Linux</title><content type='html'>This assumes that you have an account zanwar (set by your cvs admin) and cvs repository Project/Development on the CVS host cvs.cs.uiuc&lt;br /&gt;&lt;br /&gt;&gt;&gt;export CVSROOT=:pserver:zanwar@cvs.uiuc.edu:/home/compiler/cvs/cplusplus&lt;br /&gt;&gt;&gt;cvs login&lt;br /&gt;&gt;&gt;cvs co Project/Development&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-115956914232171216?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/115956914232171216/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=115956914232171216&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/115956914232171216'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/115956914232171216'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/09/setting-up-cvs-client-in-linux.html' title='Setting up CVS client in Linux'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-115956822483140226</id><published>2006-09-29T14:47:00.000-07:00</published><updated>2006-11-13T23:59:15.556-08:00</updated><title type='text'>Red Hat Network Setup</title><content type='html'>Personally I think Red Hat's network configuration utilities in no where compare to Knoppix or Ubunto for instance.&lt;br /&gt;&lt;br /&gt;Setting up networking is a very manual task. Here are the list of important files I needed to change to setup my Red Hat Enterprise Linux RHEL machine...&lt;br /&gt;&lt;br /&gt;&gt;&gt; /etc/sysconfig/network&lt;br /&gt;NETWORKING=yes&lt;br /&gt;DHCP_HOSTNAME=tsrd-rhel4-1&lt;br /&gt;DOMAINNAME=jf.intel.com&lt;br /&gt;&lt;br /&gt;&gt;&gt; /etc/sysconfig/networking/profiles/default/hosts&lt;br /&gt;127.0.0.1       localhost.localdomain   tsrd-vmrhel     localhost&lt;br /&gt;134.134.25.201  tsrd-vmrhel.jf.intel.com  tsrd-vmrhel  localhost&lt;br /&gt;&lt;br /&gt;&gt;&gt;  /etc/sysconfig/networking/devices/ifcfg-eth0&lt;br /&gt;DEVICE=eth0&lt;br /&gt;ONBOOT=yes&lt;br /&gt;BOOTPROTO=dhcp&lt;br /&gt;TYPE=Ethernet&lt;br /&gt;DOMAINNAME=jf.intel.com&lt;br /&gt;HOSTNAME=tsrd-rhel4-1&lt;br /&gt;DHCP_HOSTNAME=tsrd-rhel4-1&lt;br /&gt;&lt;br /&gt;Also use the /sbin/route command to set up the kernel routing table&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-115956822483140226?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/115956822483140226/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=115956822483140226&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/115956822483140226'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/115956822483140226'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/09/red-hat-network-setup.html' title='Red Hat Network Setup'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-115862405805320294</id><published>2006-09-18T16:54:00.000-07:00</published><updated>2006-11-13T23:59:15.437-08:00</updated><title type='text'>Linux Code Coverage profiling Tool</title><content type='html'>Compile cpp file with debug options&lt;br /&gt;&lt;span style="font-style:italic;"&gt; g++ -ggdb -fprofile-arcs -ftest-coverage -o hello Hello.cpp &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Try Running it&lt;br /&gt;&lt;span style="font-style:italic;"&gt;./hello&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Run Code Coverage tool&lt;br /&gt;&lt;span style="font-style:italic;"&gt;  gcov Hello.cpp&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;View the lines that will be executed&lt;br /&gt;&lt;span style="font-style:italic;"&gt;  vi Hello.cpp.gcov&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-115862405805320294?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/115862405805320294/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=115862405805320294&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/115862405805320294'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/115862405805320294'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/09/linux-code-coverage-profiling-tool.html' title='Linux Code Coverage profiling Tool'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-115652492041451233</id><published>2006-08-25T09:50:00.000-07:00</published><updated>2006-11-13T23:59:15.119-08:00</updated><title type='text'>Loading Dynamic Libraries</title><content type='html'>Some Linux API require the use of updated libraries. A common example is &lt;span style="font-weight:bold;"&gt;gethostbename&lt;/span&gt; command that is not thread safe. Attempting to run this with a old glibc while the network is down or with a null parameter will result in a segmentation fault. In order to see what libraries your executable is dependent upon use &lt;span style="font-style:italic;"&gt;ldd executatble name&lt;/span&gt;. In order to make your executatable use an updated version of glibc, you might need to update your library path via &lt;span style="font-style:italic;"&gt;export LD_LIBRARY_PATH=/lib/686&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-115652492041451233?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/115652492041451233/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=115652492041451233&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/115652492041451233'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/115652492041451233'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/08/loading-dynamic-libraries.html' title='Loading Dynamic Libraries'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-115652423724939910</id><published>2006-08-25T09:40:00.000-07:00</published><updated>2006-11-13T23:59:15.031-08:00</updated><title type='text'>Getting Linux Command History</title><content type='html'>Tired of remembering and repeating that long copy command again and again. Use &lt;span style="font-style:italic;"&gt;history | grep "scp" &lt;/span&gt; and you will get a list of old scp commands you used recently. Execute anyone of them bny typing &lt;span style="font-style:italic;"&gt;! command# &lt;/span&gt;. Incidently &lt;span style="font-style:italic;"&gt;!!&lt;/span&gt; repeats the last command.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-115652423724939910?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/115652423724939910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=115652423724939910&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/115652423724939910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/115652423724939910'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/08/getting-linux-command-history.html' title='Getting Linux Command History'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-115578709711675563</id><published>2006-08-16T20:54:00.000-07:00</published><updated>2006-11-13T23:59:14.945-08:00</updated><title type='text'>Creating a isoLinux Bootable CD</title><content type='html'>Open a root shell. The following commands create a temporary directory and copy the files required for the booting of the Linux system (the isolinux boot loader as well as the kernel and the initrd) into it: &lt;br /&gt;mkdir /tmp/CDroot&lt;br /&gt;cp /usr/share/syslinux/isolinux.bin /tmp/CDroot/&lt;br /&gt;cp /boot/vmlinuz /tmp/CDroot/linux&lt;br /&gt;cp /boot/initrd /tmp/CDroot&lt;br /&gt;&lt;br /&gt; Create the boot loader configuration file /tmp/CDroot/isolinux.cfg with your preferred editor. Enter the following content: &lt;br /&gt;DEFAULT linux&lt;br /&gt;LABEL linux&lt;br /&gt;  KERNEL linux&lt;br /&gt;  APPEND initrd=initrd root=/dev/hdXY [boot parameter]&lt;br /&gt;&lt;br /&gt; Enter your root partition for the parameter root=/dev/hdXY. It is listed in the file /etc/fstab. Enter additional options for the setting [boot parameter], which should be used during booting. The configuration files could, for example, look like this: &lt;br /&gt;DEFAULT linux&lt;br /&gt;LABEL linux&lt;br /&gt;  KERNEL linux&lt;br /&gt;  APPEND initrd=initrd root=/dev/hda7 hdd=ide-scsi&lt;br /&gt;&lt;br /&gt; The following command (entered at a command prompt) then creates an ISO-9660 file system for the CD.&lt;br /&gt;&lt;br /&gt;mkisofs -r -o /tmp/bootcd.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table /tmp/bootcd&lt;br /&gt;&lt;br /&gt;-r is important to be case sensitive&lt;br /&gt;&lt;br /&gt; The file /tmp/bootcd.iso can be written to CD after that with either graphical CD writing applications, like K3b&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-115578709711675563?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/115578709711675563/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=115578709711675563&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/115578709711675563'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/115578709711675563'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/08/creating-isolinux-bootable-cd.html' title='Creating a isoLinux Bootable CD'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-115288968671751538</id><published>2006-07-14T08:01:00.000-07:00</published><updated>2006-11-13T23:59:14.859-08:00</updated><title type='text'>Samba mounting Encrypted Linux file from Windows host in Vmware</title><content type='html'>&lt;span style="font-style:italic;"&gt;&lt;br /&gt;vi /etc/samba/smb.conf&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;[encrypted]&lt;br /&gt;   browseable = yes&lt;br /&gt;   comment = Encrypted FS on USB&lt;br /&gt;   writable = yes&lt;br /&gt;   locking = no&lt;br /&gt;   path = /encrypted&lt;br /&gt;   public = yes&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;&lt;br /&gt;mkdir /encrypted  &lt;br /&gt;mount -o umask=0 /dev/mapper/encrypted /encrypted/  &lt;br /&gt;/etc/init.d/samba start  &lt;br /&gt;smbpasswd -a knoppix&lt;br /&gt;&lt;br /&gt;touch /encrypted/hello.txt &lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Go edit the hello.txt file in vmware windows My Network Places -&gt; Workgroup computers&lt;br /&gt;&lt;br /&gt;Verify that it has been changed&lt;br /&gt;&lt;span style="font-style:italic;"&gt;&lt;br /&gt;cat /encrypted/hello.txt &lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-115288968671751538?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/115288968671751538/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=115288968671751538&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/115288968671751538'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/115288968671751538'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/07/samba-mounting-encrypted-linux-file.html' title='Samba mounting Encrypted Linux file from Windows host in Vmware'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-115282405816544255</id><published>2006-07-13T13:44:00.000-07:00</published><updated>2006-11-13T23:59:14.772-08:00</updated><title type='text'>Creating a encrypted patition visible from both windows and linux</title><content type='html'>Download and install uuid-dev, e2fsck and cryptsetup.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;&lt;br /&gt;dd if=/dev/zero of=myencryptedfile.enc bs=1M count=20&lt;br /&gt;losetup /dev/loop2 myencryptedfile.enc&lt;br /&gt;cryptsetup -c aes -s 256 --verify-passphrase luksFormat /dev/loop2&lt;br /&gt;cryptsetup luksOpen /dev/loop2 encrypted&lt;br /&gt;mkdosfs /dev/mapper/encrypted&lt;br /&gt;mount /dev/mapper/encrypted /mnt&lt;br /&gt;ls /mnt&lt;br /&gt;umount /mnt&lt;br /&gt;cryptsetup luksClose encrypted&lt;br /&gt;losetup -d /dev/loop2&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-115282405816544255?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/115282405816544255/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=115282405816544255&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/115282405816544255'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/115282405816544255'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/07/creating-encrypted-patition-visible.html' title='Creating a encrypted patition visible from both windows and linux'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-115151795847516007</id><published>2006-06-28T11:03:00.000-07:00</published><updated>2006-11-13T23:59:14.693-08:00</updated><title type='text'>Modifying the kernel's make install initrd image</title><content type='html'># Login as root&lt;br /&gt;# mkdir myinitrd&lt;br /&gt;# cd myinitrd&lt;br /&gt;# gzip -dc &lt; /boot/initrd-your-version-here.img | cpio -i&lt;br /&gt;# edit init do what you want at the top of the script. Usually custom scripts added after mounting /proc but before mounting any drives&lt;br /&gt;# find . | cpio -o -c |gzip -9 &gt; /boot/initrd-your-version-here.img&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-115151795847516007?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/115151795847516007/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=115151795847516007&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/115151795847516007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/115151795847516007'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/06/modifying-kernels-make-install-initrd.html' title='Modifying the kernel&apos;s make install initrd image'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-115143044085063365</id><published>2006-06-27T10:36:00.000-07:00</published><updated>2006-11-13T23:59:14.604-08:00</updated><title type='text'>Single Writer Multiple Readers using Anonymous Pipes</title><content type='html'>Use the tee command. Here is an example where I use pipes and the linux cut/paste command to implement a windows like "scanning wireless networks available" in linux.&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;&lt;br /&gt;scan_nets(){&lt;br /&gt;echo "Going to scan nets"&lt;br /&gt;rm -rf *.trace&lt;br /&gt;iwlist $wintf scanning | tee &gt;(grep "ESSID" |cut -d ':' -f 2 &gt; essid.trace ) &gt;(grep "Encryption"|cut -d ':' -f 2 &gt; enc.trace ) | (grep "Quality"|cut -d '=' -f 2 &gt; quality.trace)&lt;br /&gt;&lt;br /&gt;paste -d " :" essid.trace enc.trace &lt;(cut -d " " -f 1,3 quality.trace) &gt; table&lt;br /&gt;availnets=`cat table`&lt;br /&gt;&lt;br /&gt;selected_net=$($DIALOG --stdout --title "Scanned Networks Available. " --radiolist "Press Cancel to enter your own ESSID &lt;br /&gt;&lt;br /&gt;ESSID Encypted? Signal Strength" 18 45 12 $availnets)&lt;br /&gt;retval1=$?&lt;br /&gt;case $retval1 in&lt;br /&gt;  0)&lt;br /&gt;    echo "Input string is $selected_net";;&lt;br /&gt;  1)&lt;br /&gt;    echo "Cancel pressed.";;&lt;br /&gt;    #No problem will prompt for essid later&lt;br /&gt;  255)&lt;br /&gt;  $DIALOG --no-close --no-buttons --title "Disable Network" --infobox "User Interrupt going to disable the network" 8 32 10&lt;br /&gt;    ;;&lt;br /&gt;esac&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-115143044085063365?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/115143044085063365/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=115143044085063365&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/115143044085063365'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/115143044085063365'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/06/single-writer-multiple-readers-using.html' title='Single Writer Multiple Readers using Anonymous Pipes'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-114997550042793089</id><published>2006-06-10T14:35:00.000-07:00</published><updated>2006-11-13T23:59:14.434-08:00</updated><title type='text'>Creating symbolic links for bootup scripts</title><content type='html'>If you want to startup a certain service e.g. vmware in runlevel 4 during system bootup.&lt;br /&gt;&lt;br /&gt;cd /etc/rc4.d&lt;br /&gt;ln -s ../init.d/vmware S90vmware&lt;br /&gt;&lt;br /&gt;The S (as apposed to K) signifies that you want this script to run and the 90 determines the order of being called in this folder.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-114997550042793089?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/114997550042793089/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=114997550042793089&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/114997550042793089'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/114997550042793089'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/06/creating-symbolic-links-for-bootup.html' title='Creating symbolic links for bootup scripts'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-114986706273547042</id><published>2006-06-09T08:23:00.000-07:00</published><updated>2006-11-13T23:59:14.356-08:00</updated><title type='text'>Coping folders between Machines</title><content type='html'>Make sure you ssh/scp deamon is running.&lt;br /&gt;&lt;span style="font-style:italic;"&gt;/etc/init.d/ssh start&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Regenerate host keys for ssh if necessary&lt;br /&gt;&lt;span style="font-style:italic;"&gt;ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;package your folder&lt;br /&gt;&lt;span style="font-style:italic;"&gt;tar -cvf folder.tar folder | gzip &gt; folder.tgz&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;copy it&lt;br /&gt;&lt;span style="font-style:italic;"&gt;scp folder.tgz root@192.168.1.5:/home/anwar/myfiles&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;extract it&lt;br /&gt;&lt;span style="font-style:italic;"&gt;gunzip folder.tgz&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;tar -xvf folder.tar&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Alternatively you can also use&lt;br /&gt;&lt;span style="font-style:italic;"&gt;smbmount //ipaddress/path/to/folder /mountfolder -o username=anwar&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-114986706273547042?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/114986706273547042/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=114986706273547042&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/114986706273547042'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/114986706273547042'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/06/coping-folders-between-machines.html' title='Coping folders between Machines'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-114986390370249702</id><published>2006-06-09T07:35:00.000-07:00</published><updated>2006-11-13T23:59:14.283-08:00</updated><title type='text'>Linux Managing multiple Network interfaces</title><content type='html'>If you have multiple network interfaces on your machine e.g. a wireless (check using iwconfig) and wired. i.e. eth0 and eth1. Linux will end up using the first one it finds. In order to use the interface of your choice, you can disable one or the other.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;ifconfig eth1 down&lt;/span&gt; and force the other to take over using the pump command.&lt;br /&gt;&lt;br /&gt;# pump -i eth0 --status&lt;br /&gt;Check the status / get details of dhcp on eth0&lt;br /&gt;&lt;br /&gt;# pump -i eth0 --release&lt;br /&gt;Release dhcp IP on eth0&lt;br /&gt;&lt;br /&gt;# pump -i eth0&lt;br /&gt;Request a dhcp ip for eth0&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-114986390370249702?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/114986390370249702/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=114986390370249702&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/114986390370249702'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/114986390370249702'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/06/linux-managing-multiple-network.html' title='Linux Managing multiple Network interfaces'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-114970523744121210</id><published>2006-06-07T11:11:00.001-07:00</published><updated>2006-11-13T23:59:14.187-08:00</updated><title type='text'>Setting up Knoppix file system on a hard drive</title><content type='html'>A Knoppix installation on you hard drive will use unionfs by default. You can check to see which folders are part of the unionfs tree by using the &lt;span style="font-style:italic;"&gt;mount&lt;/span&gt; command and you can add more folders via&lt;br /&gt;&lt;span style="font-style:italic;"&gt;mount -t unionfs -o dirs=/ramdisk=rw:/KNOPPIX=rw unionfs /&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Normally you can only write in the /KNOPPIX folder and therefore you will need to remount it to be writable via&lt;br /&gt;&lt;span style="font-style:italic;"&gt;mount -o remount, rw /KNOPPIX/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Another thing you might want to do is &lt;span style="font-style:italic;"&gt;chroot /KNOPPIX/&lt;/span&gt; so that you don't confuse / with /KNOPPIX&lt;br /&gt;&lt;br /&gt;Before chrooting you can mount the /proc and /dev to the new folders.&lt;br /&gt;&lt;span style="font-style:italic;"&gt;mount -o bind /proc /KNOPPIX/proc&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-114970523744121210?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/114970523744121210/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=114970523744121210&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/114970523744121210'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/114970523744121210'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/06/setting-up-knoppix-file-system-on-hard_07.html' title='Setting up Knoppix file system on a hard drive'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-114962058232138491</id><published>2006-06-06T10:44:00.000-07:00</published><updated>2006-11-13T23:59:14.017-08:00</updated><title type='text'>Setting up and Formatting encrypted Partitions</title><content type='html'>losetup -e AES128 -T /dev/loop7 /dev/sda7&lt;br /&gt;&lt;br /&gt;format&lt;br /&gt;mke2fs -j /dev/loop7&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-114962058232138491?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/114962058232138491/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=114962058232138491&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/114962058232138491'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/114962058232138491'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/06/setting-up-and-formatting-encrypted.html' title='Setting up and Formatting encrypted Partitions'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-114954764010201945</id><published>2006-06-05T15:38:00.000-07:00</published><updated>2006-11-13T23:59:13.933-08:00</updated><title type='text'>changing &amp; formatting partitions</title><content type='html'>I prefer using cfdisk over fdisk because it is menu driven. Usually creating a partition table will involve a hda1 primary boot partition followed by a extended partition hda5 (linux), hda 6 (swap) and so on.&lt;br /&gt;&lt;br /&gt;format boot via&lt;br /&gt;mkfs.vfat -F 16 -n NAME -v /dev/hda1&lt;br /&gt;&lt;br /&gt;format linux via&lt;br /&gt;mke2fs -j -L KNOPPIX /dev/hda5&lt;br /&gt;&lt;br /&gt;turn off filesystem checking via&lt;br /&gt;tune2fs -c 0 /dev/hda5&lt;br /&gt;&lt;br /&gt;set up swap via&lt;br /&gt;mkswap /dev/hda6&lt;br /&gt;&lt;br /&gt;changing a label of partition after you put your data on it&lt;br /&gt;tune2fs -L NEWLABEL /dev/hda5&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-114954764010201945?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/114954764010201945/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=114954764010201945&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/114954764010201945'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/114954764010201945'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/06/changing-formatting-partitions.html' title='changing &amp; formatting partitions'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-114928536455307844</id><published>2006-06-02T14:55:00.000-07:00</published><updated>2006-11-13T23:59:13.860-08:00</updated><title type='text'>Disk Space Remaining</title><content type='html'>df -h&lt;br /&gt;&lt;br /&gt;and &lt;br /&gt;&lt;br /&gt;du -hsc &lt;filename&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-114928536455307844?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/114928536455307844/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=114928536455307844&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/114928536455307844'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/114928536455307844'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/06/disk-space-remaining.html' title='Disk Space Remaining'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29178799.post-114928158759155942</id><published>2006-06-02T13:44:00.000-07:00</published><updated>2006-11-13T23:59:13.762-08:00</updated><title type='text'>Mounting a compressed image</title><content type='html'>Needed when mounting a compressed KNOPPIX file found in the linux boot partition. For instance you need to recover some USB modules to place directly in miniroot.&lt;br /&gt;&lt;br /&gt;insmod cloop.o file=/path/to/compressed/image&lt;br /&gt;&lt;br /&gt;mount -o ro -t whatever /dev/cloop /mnt/compressed&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29178799-114928158759155942?l=hackinglinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hackinglinux.blogspot.com/feeds/114928158759155942/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29178799&amp;postID=114928158759155942&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/114928158759155942'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29178799/posts/default/114928158759155942'/><link rel='alternate' type='text/html' href='http://hackinglinux.blogspot.com/2006/06/mounting-compressed-image.html' title='Mounting a compressed image'/><author><name>zahid</name><uri>http://www.blogger.com/profile/16171916104340171068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
