Pressing Ctrl-Alt-F4 will give you a prompt for tty3. Note that it is one number less. Take a look at the contents of /etc/securetty file. To prevent root from logging in on this device, take out tty3 from this listing. Note, you can always login as another user, then, su to root. Below is an example of the default "/etc/securetty" that allows root to login to everything:

# cat /etc/securetty
console vc/1 vc/2 vc/3 vc/4 vc/5 vc/6 vc/7 vc/8 vc/9 vc/10 vc/11 tty1 tty2 tty3 tty4 tty5 tty6 tty7 tty8 tty9 tty10 tty11

All the professional filesystems store at least three type of date for each file. These are file creation time, last modified time and the last accessed time.

File's last accessed time changes very frequently, even a directory listing operation leads to change all of the files' last accessed time information under that directory. So, this will introduce a filesystem overhead. If you don't need to exact last accessed time of files under specific mount point, you can disable this future with the noatime mount option. to do this, edit /etc/fstab and add noatime option in the option group field like below:

/dev/sda7   /var   ext3   defaults,noatime   0 0

In order to take effects immediately, you can remount this partition with:

mount -o remount /var

This change can improve the overall filesystem performance in a heavy loaded web server or database system.

To enable the special keys (Volume Up-Down, Mute) on my Lenovo 3000 N200,  installed kmilo package:

sudo apt-get install kmilo

But there is a bug at Debian for kmilo (bug#396622), because of this, i have to install xkeycaps package to map the special keys manually:

sudo apt-get install xkeycaps

Then paste this key bindings in the ~/.Xmodmap file:

keycode 129 = XF86AudioMedia
keycode 144 = XF86AudioPrev
keycode 153 = XF86AudioNext
keycode 160 = XF86AudioMute
keycode 161 = XF86Calculator
keycode 162 = XF86AudioPause
keycode 164 = XF86AudioStop
keycode 174 = XF86AudioLowerVolume
keycode 176 = XF86AudioRaiseVolume
keycode 223 = XF86Standby

And finally, give this command:

xmodmap .Xmodmap

That's it. Enjoy :)

To enable remote desktop on a VirtualBox machine, you have to follow these steps:

VBoxManage modifyvm MachineName -vrdp This command enables rdp on the virtual machine

VBoxManage startvm MachineName -type vrdp

It starts virtual machine, listening for rdp request on port 3389 (default port)

rdesktop-vrdp localhost 

Connects virtual machine with rdp (You can use rdesktop too).

If you want to change rdp port, use this command:
VBoxManage modifyvm MachineName -vrdpport <port>

Also, enabling authentication for rdp is possible:

VBoxManage modifyvm MachineName -vrdpauthtype null | external | guest

VBoxManage is the command line interface of the VirtualBox.

You can make these settings with GUI: Settings -> Remote Display -> Enable VRDP Server

If you want to use your virtual machine with vrdp only, you can use this command simply:

VBoxHeadless -startvm MachineName

Note: RDP server is not included in Open Source Edition of the VirtualBox. If you want to use this feature, you have to use closed-source edition.

Suppose that you have to build a root filesystem which will be dumped on thousands of systems and you have multiple ethernet interfaces of same chip, same kernel driver. You will realize that some of the systems start use ethernet interfaces with eth1, eth2 and some of them eth3, eth7 etc.

In order to have a persistent ethernet interface naming, you should give a udev rule to specify which name assigned which card. In this stage, it is possible to use some udev variables for given device. You can look at this:

udevinfo -a -p /sys/class/net/eth1
    KERNEL=="eth1"
    SUBSYSTEM=="net"
    DRIVER==""
    ATTR{addr_len}=="6"
    ATTR{iflink}=="3"
    ATTR{ifindex}=="3"
    ATTR{features}=="0x0"
    ATTR{type}=="1"
    ATTR{link_mode}=="1"
    ATTR{address}=="00:15:00:4a:67:b6"
   ...

read more

From version 2.6.16 Linux kernel has a tunable parameter named /proc/sys/vm/drop_caches

If you want to force to clear pagecaches from memory use:

echo 1 > /proc/sys/vm/drop_caches

If you want to clear dentry and inode caches from memory:

echo 2 > /proc/sys/vm/drop_caches

and if you want to clear both of the pagecaches and dentry and inode caches just use:

echo 3 > /proc/sys/vm/drop_caches

In order to make sure all cached objects are freed you must execute the sync command first.

There is a known issue (it is a design issue) with Linux networking stack. If you have multiple interface to connect wan side, for example ppp0 is dialup, eth0 leased line, wlan0 wireless etc. normally you have 3 default routing entry also. In this case, if a packet arrives from ppp0 interface, their reply packets sent from default router and it can be wlan0 interface. So, connection can't be established.

 

To solve this problem, reply packets must be return back with same interface. If packet arrives from ppp0 interface, their replies also must sent from ppp0 interface too.

To do this, we'll use iproute package. First of all, a routing table entry must be created:

echo 101 Tppp0 >> /etc/iproute2/rt_tables

Second, we have to say ppp0 packets routed by the Tppp0 table:

ip rule add dev ppp0 table Tppp0

And we have to say that table Tppp0's default router is the default router of ppp0 interface:

ip route add default dev ppp0 table Tppp0

Last, we can flush routing cache:

ip route flush cache

You can repeat above steps for other interfaces too. If so, you have to give a uniq id between 0-255 when creating new table entries in rt_tables file.

 

Please note that, this is most simple solution and you can make too different / complex setup for different policy routing needs with iproute.

With default configuration of vsftp (vsftpd.conf under /etc) users with no shell or /bin/false shell are not able to login vsftpd ftp server. This is because vsftpd.conf includes such a line to enable pam module.

pam_service_name=vsftpd

This line points to which pam service name will be applied. Pam configuration related to vsftpd is  then  /etc/pam.d/vsftpd .

This pam file contains a file such as:

auth   required        pam_shells.so

read more

To redirect TCP connections with redir utility,  Simply type the

command such as below

 

redir --laddr=<listen_address> --lport=<listen_port>  --caddr=<connect_address>  --cport=<connect_port>

 

Suppose that the ip address of our system is 60.50.40.31 and we woud like to connect to 64.64.64.64  ip address and 3120 port over our system. Simply, we want redir utiliy to redirect connections coming to 60.50.40.31 on port 3120 to 64.64.64.64  port 3120. We have to run redir such as below to do so:

redir --laddr=60.50.40.31 --lport=3120  --caddr=64.64.64.64 --cport=3120

 

  Local address specified with --laddr should be one of the ip addresses that we can access  our redirecting system. Setting other ip addresses will make no sense.  We can set various combinations using the parameters such as we can set local listening port to 80 and remote connect port to 3120 to make clients connect to 80 istead of 3120.

 

We usually use gcc to compile c codes. However, to see assembly code of the C code

that we write, we should add "-S" option while compiling the code.

 

gcc -S -c code.c

 

   The command above compiles code.c as it generates code.s file which includes assembly code.

read more