Check These Out
the below command create a alias for share your internet connection with another.
$ifconfig eth0:1 192.168.0.1/24
Its obviously necessary too activate the iptables post-routing and ip forwarding, as root:
$modprobe iptable_nat
$iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
$echo 1 > /proc/sys/net/ipv4/ip_forward
Be sure that the alias 192.168.0.0/24 is not your active real ip range
If you don't have nl on your system, this achieves a similar effect, the default behavior in nl is to not number blank lines, but this does.
Resize `file.png` to a 32x32 px image. Use a value other than 32 to create other icon sizes (e.g. 16x16 or 32x32). Combine two favicon sizes using: `convert icon-16px.png icon-32px.png favicon.ico`
For a social media preview image, use `2:1#` for the extent and `1200` for the scale.
Replace 'csv_file.csv' with your filename.
I actually planned to do this for quite a long time, but since I haven't had any suitable client hardware, I procrastinated this.
Now, the old laptop I've got from my dad, features an RS-232 port. So, now that I had technically a client, that I could test my RS-232 connection with, I ordered a null modem cable.
There is no RS-232 outlet on my desktop computer directly on the mainboard, but theres a connector on the mainbord, where a RS-232 outlet can be attached to. The outlet will then cover up a PCI slot.
# Activating RS-232
Ok, once all cables were in place, I tried to access both RS-232 ports by reading from them directly. They're usually ttyS0 or ttyS1, depending what COM-Port it is.
From the file /proc/tty/driver/serial, information about the serial setup can be obtained.
A setserial -q /dev/ttyS0 might be usefull as well. Usually, the UART Type is 16550A, on a standard PC. Mine wasn't working though.
At leas not right from the start, when I tried to read the interface with cat /dev/ttyS0 I got the following error:
# cat /dev/ttyS0
cat: /dev/ttyS0: Input/output error
Obviously, the driver couldn't activate the hardware. Reason was, it was deactivated in BIOS. After activating RS-232 there, it worked well.
As a last action, I added myself to the uucp group, so I have user permission to the serial lines. It is not necessary for the terminal setup, but a good idea to do so, just for future projects, maybe...
# Setting up a terminal
Once the Serial line is configured and working properly, it's time to let a terminal run on that port. This is what I added to my /etc/inittab :
s0:2345:respawn:/sbin/agetty -L 38400 ttyS0
I added it quite on the top of that file, right below the 'si' statement, mingetty cannot be used for serial connections, it cannot be run in a console, too. I tried it for testing purposes, but the cosole - along with your login program - will log you out, as soon as you log in over your serial line.
'-L' means this is a local line, with no carrier signal. 38400 is the standard speed of a Linux console, it might be a bit high, I was told, but it works well. I tested that with some higher values as well (115200) and it worked too, I guess it tepends on things like cable length, etc. Last parameter, is the serial tty to listen on. The terminal type can be specified as an additional parameter at the end of the parameter list, vt102, for instance. This is sometimes required, depending on the client.
After finishing editing /etc/inittab, an init q will make the system re-read /etc/inittab and apply changes. The agetty should now be listening on ttyS0.
#Setting up a client
It's time to establish a connection and test the serial line. I use a laptop, that has an RS-232 port, so some preliminary setup is required. I tried minicom as terminal initially, but it turned out, not to be the best client. It initializes the modem, this lasts quite long, and it doesn't convey ANSI colors. So the better option is cu, it's part of the UUCP-Package.
Oh, and the serial port of that computer, has to be accessible as well, of course.
Once everything was set up, I established the connection:
$ cu -l ttyS0 -38400 --nostop
Pretty self explanatory, I think. The --nostop option disables XON/XOFF handling.
# root access over ttyS0
In order to become root over the serial terminal, the tty needs to be added to /etc/securetty
I appended ttyS0 to the end of the file. It is now possible, to gain root access over the serial terminal. The agetty process needs to be restarted to apply changes.
# Accessing GRUB over ttyS0
To make bootloader access possible over ttyS0, some changes to /boot/grub/menu.lst need to be done. (GRUB is the bootloader I use, I suppose LiLo has similar capabilities.)
Those are the lines, I appended to the top of my menu.lst :
serial --unit=0 --speed=38400 --word=8 --parity=no --stop=1
terminal --timeout=3 serial console
The serial command initiates the serial terminal option, --unit=0 defines our first serial connector, I my case, it's the only one I have on my machine. I used the standard Linux-Console speed, as well as the "8N1" connection strategy.
terminal defines the terminal priorities, first terminal (serial) is the standard one, the last one is the secondary terminal (console).
--timeout=3 enables a delay on both consoles, with a prompt for a keystroke. Depending on which terminal, the key is pressed, this terminal, will be used. If no key is pressed after the timeout, the standard console (in my case serial) will be used.
# Relaying Kernel output on boot
The Kernel accepts multiple console options, of which the last one, is the standard console, and the one that will be used in Single User mode. These are my Kernel options:
title Fedora Core (2.6.20-1.2316.fc5)
root (hd0,0)
kernel /vmlinuz-2.6.20-1.2316.fc5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet vga=795 console=tty0 console=ttyS0,38400
initrd /initrd-2.6.20-1.2316.fc5.img
console=tty0 is the standard console, located on the machine, i.e. monitor and keyboard.
Was playing with the shell. It struck to me, just by rearranging the parameters, i was able to remember what they did and in a cool way.
Enter the 'hitlar' mode.
bash-3.2$ ls -hitlar
Shows all items with inodes, in list view, human readable size, sorted by modification time in reverse,
bash-3.2$ ls -Fhitlar
Shows the same with classification info. Add the hitlar mode alias to your .bashrc.
bash-3.2$ echo "alias hitlar='ls -Fhitlar'" >> ~/.bashrc
bash-3.2$ hitlar
bash-3.2$ hitlar filename
include in the list human readable hidden files too:
$ file .* *|grep 'ASCII text'|sort -rk2
more reliable command:
$ ls|xargs file|grep 'ASCII text'|sort -rk2
and include hidden files:
$ ls -a|xargs file|grep 'ASCII text'|sort -rk2
This is just a proof of concept: A FILE WHICH CAN AUTOMOUNT ITSELF through a SIMPLY ENCODED script. It takes advantage of the OFFSET option of mount, and uses it as a password (see that 9191? just change it to something similar, around 9k). It works fine, mounts, gets modified, updated, and can be moved by just copying it.
USAGE: SEE SAMPLE OUTPUT
The file is composed of three parts:
a) The legible script (about 242 bytes)
b) A random text fill to reach the OFFSET size (equals PASSWORD minus 242)
c) The actual filesystem
Logically, (a)+(b) = PASSWORD, that means OFFSET, and mount uses that option.
PLEASE NOTE: THIS IS NOT AN ENCRYPTED FILESYSTEM. To improve it, it can be mounted with a better encryption script and used with encfs or cryptfs. The idea was just to test the concept... with one line :)
It applies the original idea of http://www.commandlinefu.com/commands/view/7382/command-for-john-cons for encrypting the file.
The embedded bash script can be grown, of course, and the offset recalculation goes fine. I have my own version with bash --init-file to startup a bashrc with a well-defined environment, aliases, variables.