Monday, July 28, 2008

linux malayalam font installation

aarklon


recently i got a font from my friends office,named xxxxx.ttf . it is used there for typing malayalam language on a knoppix system. can any one give instructions as on how to install this font????



Manually
There are various locations in GNU/Linux in which fonts can be kept. These locations are defined in /etc/fonts/fonts.conf; standard ones include /usr/share/fonts, /usr/local/share/fonts, and /home//.fonts (where is your user name).

The easiest way to install a truetype font is to press alt-F2 and enter the following code (this will open nautilus in the right directory):

gksu nautilus /usr/share/fonts/truetype
Then create a new directory, name the directory whatever you like (choose a name that you remember if you ever need to backup your fonts personal fonts). Copy the fonts into that directory and finally rebuild the font information files by pressing alt-F2, mark 'run in terminal' so you can see the progress and entering the following code:

sudo fc-cache -f -v
Note: After you install a new font, you will need to make sure that programs in which you want to use the new fonts can recognize them. In most cases this is done by closing and reopening the programs; however, some programs may require you to log out and log back in.

The easiest place for people to put their fonts is /home//.fonts. If you have not already done so, create this folder:

Open your home folder in Nautilus (GNOME) or Konqueror (KDE).

Since dot-folders are really hidden folders, you need to choose "Show Hidden Files" from the View menu.

Go to File -> Create Folder (GNOME), or right-click and choose Create New -> Folder (KDE).

Name the new folder ".fonts".

Now double click on the folder to open it, and drag and drop your fonts into the folder.

On GNOME, you can also directly open the virtual folder fonts:/ (within a Nautilus window, choose Go -> Location or press Ctrl+L) and drag and drop fonts into this folder. (Does not work in in Hardy Heron 8.04 due to changes. Please follow the method above.)

However, fonts that are added by either of the ways above will only be available for one user. To make them available system-wide, drag and drop them to the directory /usr/share/fonts. (Note: If you're on Kubuntu you may have to cd to /usr/share/fonts and run mkfontscale, mkfontdir, fc-cache after this. See the instructions below.)

As in the last method, on GNOME you can also add fonts directly to fonts:/. However, you must open the virtual folder as root. You can do this by opening a terminal window and running

gksudo nautilus fonts:
Enabling Bitmapped Fonts
If you'd like to use a fixed font in your terminal, use this command:

sudo dpkg-reconfigure fontconfig
or, at least in Edgy,

sudo dpkg-reconfigure fontconfig-config
Don't change anything on the first and second screen, and choose to enable bitmapped fonts on third screen. Now you can select some new fixed fonts in your gnome-terminal's profile. Terminus is suitable for terminals; to install this font in command line, run apt-get install xfonts-terminus or use Synaptic (see above).

Alternatively, you can use Inconsolata, a monospaced font from Raph Levien. It is a very good font for the terminal.

see:-https://wiki.ubuntu.com/Fonts

download malayalam fonts here:-

http://ifile.it/49yikqx/malayalam-fonts.zip
http://ifile.it/49yikqx

Friday, July 25, 2008

Adding extra repositories in 8.04

It is possible to add extra repositories, such as those provided by third parties or those for older version of Ubuntu.
[Caution]

Be careful when installing software from third-party repositories. It may not have been tested with Ubuntu and could cause your system to break.

1.

Open System → Administration → Software Sources and press Third Party Software.
2.

Press Add to add a new repository.
3.

Enter the APT line for the extra repository. This should be available from the website of the repository or similar, and should look similar to the following:

deb http://ftp.debian.org etch main

4.

Press Add Source and then click Close to save your changes.
5.

You will be notified that the information about available software is out-of-date. Press Reload.
6.

Most software repositories use a GPG key to digitally sign the files they provide, which makes it easy to check that the files have not been tampered with since their creation. In order for apt to be able to check this, you need the public key that corresponds to the signatures. The key should be available for download on the repository's website.
7.

Once you have downloaded the GPG key, import the key by selecting the Authentication tab, clicking on Import Key File, and then selecting the GPG key to be imported.

Wednesday, July 23, 2008

create swap parition that can be used by both windows and linux


Is it possible to create swap parition that can be used by both windows and linux O.S es,independant of filesystems, in a dual boot system ?



tamoneya

no because windows doesnt use swap partitions it uses a swap file which they call the "paging file". since one uses a file and one uses a partition it is a little difficult to share them. It is however simple to use the same swap file across multiple linux distros.


rocket2DMn

Indeed, Windows has the pagefile.sys file which it uses in the same manner that linux uses a swap partition


Gallienus

Actually, it's possible to set up Ubuntu to use a swap file rather than a swap partition -- I did it on my computer (Hardy) using the following information.

https://help.ubuntu.com/community/SwapFaq#How%20do%20I%20add%20more%20swap?

I wonder if it would be possible to set up Ubuntu so that it uses the pagefile.sys on the Windows partition instead of its own swap file? Note, that's something I haven't tried, so it could well be very risky. I very much doubt that the two swap file formats are compatible.


grim4593

Actually, you can share the pagefile.sys file. Windows clears it on every boot, so anything that is put there by linux is wiped out. So in order to get linux to use the file sucessfully, you have to mkswap pagefile.sys and turn it on every boot. The only issue is that you can't hibernate on one system, and then boot the other without messing up the swapfile.

I have successfully done this.see:- http://hype-free.blogspot.com/2007/08/setting-up-laptops.html


Lew Pitcher

Yes, it is possible
http://tldp.org/HOWTO/Swap-Space.html


Grant

>http://tldp.org/HOWTO/Swap-Space.html
Yeah, but these days, why bother? RAM is cheap, disk is cheap, and dual booting going out of fashion in favour of vmware and friends.


anon

Yes! But why? with cheap TB drives it is easier just to use two partitions.A better swapper partition version is to add extra RAM and use the RAM as swapper files. Then using UPS shutdown software, copy the RAM swapper to a disk partition or file if and when needed.

Wednesday, July 16, 2008

How to clean /tmp/ folder contents on shutdown

sudo cp /etc/init.d/sysklogd /etc/init.d/sysklogd_backup
gksudo gedit /etc/init.d/sysklogd

* Find this section

...
stop)
log_begin_msg "Stopping system log daemon..."
start-stop-daemon --stop --quiet --oknodo --exec $binpath --pidfile $pidfile
log_end_msg $?
...

* Add the following line below it

rm -fr /tmp/* /tmp/.??*

NB:- tested on Dapper

kill -9 -1

aarklon

I was going through the book "Hacking Ubuntu" by Neil Krawetz, in this book it is said that never do kill -9 -1 as root.In my office i tried this command as root on an RHEL4 machine but there was'nt any system crash as i expected only the x-server got crashed, and the commands like ps, ls were n't giving any o/p.when i rebooted the machine everything was back to normal

my question why init process wasn't killed ?

sebastian weisner

"A PID of -1 is special; it indicates all processes except the kill process itself and init."

evets25

My guess would be it's because Ubuntu has shifted away from the traditional init system and moved to something called "upstart." If you're interested in learning more about it, there's a great article on it here,http://www.linux.com/feature/125977.


trickykid

Well, first of all, you should never do a kill -9, you should always try to kill a process gracefully. -9 is always the last resort.As for killing init, pfft... you can't kill init from what I recall. That would just be stupid.


tredegar


Quote:
but there was'nt any system crash as i expected Linux is graceful. What did you expect, your computer to explode, with fireworks?

Quote:
the commands like ps, ls were n't giving any o/p.No, they are not giving any output, because they do not exist.

kenoshi

kill -9 -1 kills all processes owned by the user executing it, except for the shell you executed it from, with exception to root users.

Historically its used by non-root users to clean up after themselves, typically before logoff.

If you are logged in as root and run kill -9 -1 however, only root processes blocking SIGKILL (e.g. kernel threads) will remain. Everything else that belongs to root, including most daemons spawned through runlevel 1 - 5 such as dhclient, sendmail, sshd (you just booted everyone), ntpd, etc, will be killed.

On Redhat/CentOS systems, at runlevel 5 mingetty will be respawned to set up tty 1 - 6. Then the chosen/preferred desktop manager will be respawned via prefdm. Therefore it'll appear as if X server crashed and restored itself.

But if you look at processes closely, you'll see that nothing else is running except for the ttys, kernel threads, and bunch of desktop/gui processes.

This is one of the many many many many reasons why root access should be restricted...I've got horror stories about this one. Sometimes you just gotta learn the hard way I guess...

kill -9 1 doesn't work on Linux...its an old Solaris thing if memory serves.

Tuesday, July 15, 2008

Install Telnet Server in Ubuntu

A terminal emulation program for TCP/IP networks such as the Internet. The Telnet program runs on your computer and connects your PC to a server on the network. You can then enter commands through the Telnet program and they will be executed as if you were entering them directly on the server console. This enables you to control the server and communicate with other servers on the network. To start a Telnet session, you must log in to a server by entering a valid username and password. Telnet is a common way to remotely control Web servers.



You will find the Telnet server installation packages in Synaptic under the telnetd package.If you want to install telnet server package you can also use the following command

sudo apt-get install telnetd

This will complete the installation.Now you Restart inetd service using the following command

sudo /etc/init.d/inetd restart

Once installed, select Administration, Services and enable Telnet

you can now fire up your other Linux box and type telnet . You are prompted to enter your username and password. The whole conversation should look like this

telnet 192.168.0.1
Trying 192.168.0.1…
Connected to 192.168.0.1 (192.168.0.1)
Escape character is ‘^]’.
Welcome to telnetserver
Running Ubuntu LAMP server

* All access is logged *

login: admin12
Password:
Last login: Sat Dec 25 1:05:1 from 192.168.0.1
[admin12@telnetserver ~]$

If you are using windows machine you can download telnet clients if you like like putty and teraterm to connect.

Note that the server responds with Welcome to telnetserver, running Ubuntu LAMP server, which is a customized message. Your machine will probably respond with Ubuntu and some version information. This is insecure: giving away version numbers is never a smart move. In fact, even saying Ubuntu is questionable. Edit the issue and issue.net files in your /etc directory to change these messages.

Running the w command now shows you as connecting from the external IP address.

Telnet is fast but also insecure. It sends all your text, including your password, in plain text that can be read by anyone with the right tools. SSH, on the other hand, encrypts all your communication and so is more resource-intensive but secureeven a government security agency sniffing your packets for some reason would still have a hard time cracking the encryption.

Friday, July 11, 2008

Using Wine on Ubuntu

Installing Wine
Make sure you have extra repositories enabled.

In a terminal, type:
sudo aptitude update
sudo aptitude install wine

Using Wine
A bit about Wine... I don't know how it works, but it does seem to work with a lot of simple Windows programs. I'll show you how I get Filezilla to work in Linux, as an example.

I download the setup.exe file for Filezilla. When I double-click on it, Wine will try to open the file. Then, the installer appears, just as if I were using Windows. Instead of installing Filezilla to
C:\Program Files\Filezilla\
, I'm going to override the default installation location and install it to
z:\home\username\.wine\drive_c\Program Files\Filezilla
. For some reason,
z:\
is what Wine calls my Ubuntu partition.

Then, I set up a launcher (on the panel or in the menu) for the command
wine "z:\home\username\.wine\drive_c\Program Files\Filezilla\Filezilla.exe"

That's it. Now when I click on that launcher, Filezilla will load up.

Beyond Wine
As I said before, Wine seems to work with some simple Windows programs. For other Windows programs (particularly those that require Windows XP or 2000), you may need Crossover Office (this is not cost-free). If you're into gaming, you may need Cedega (also not cost-free). Other solutions include dual-booting, using two computers and a KVM switch, installing Windows in a VMWare session, or (God forbid) actually using a native Linux program.

see:-http://www.psychocats.net/ubuntu/wine

Ubuntu: Sending command line mail

I needed to send email from the command line, specifically for cron jobs, and there are many programs which can do this. I'm going to use the gnu mailutils package so first off let's install the mailutils package:

# apt-get install mailutils

This will add a few extra packages, then bring us up into an exim4 configuration screen. My systems are behind a dsl router, and I'm not going to route the mail through any relay host, I just want everything sent direct (for some sendmail agents this might cause problems, but you'll have to look at your logfiles). In the exim4 config screen I pick "internet site... mail is sent and receieved directly using SMTP". On edgy you might have to answer a few more questions, but I had to run a dpkg-reconfigure.

At this point we have exim4 listening on port 25 and I don't need that, so I need to stop the daemon and remove the startup links:
# /etc/init.d/exim4 stop
# update-rc.d -f exim4 remove

The update-rc.d command removes inits startup/shutdown links, but unfortunately if the exim4 packages get updated the links will be back so we need to run that command again.

Now lets try sending a test mail:
# echo testing | mail -s Bla myemail@somewhere.com

and take a look at /var/log/exim4/mainlog. You should be good to go!

Tested under dapper and edgy.

Comments
An easiest way would have been to install the ssmtp package before mailutils. No big exim package would have been installed then

Wednesday, July 9, 2008

immutable files

immutable files

immutable attribute. if this is set,even root cannot delete the file until the attribute is unset.

use lsattr command to see whether immutable flag is set for a file or a directory

to make a file immutable use chattr command with -i flag


ex:- touch keep.me
chattr +i keep.me
lsattr keep.me

rm -f keep.me

cannot remove keep.me operation not permitted

chattr -i keep.me
rm -f keep.me


changing immutable flag requires root authority.making files immutable is often done as part of a security / intrusion detection effort. see man capabilities for more information

restricted shell

this is what i have read in the book ubuntu linux unleashed,

if you have a desire to severly restrict what a user can do, you can provide him with a restricted shell. to run a restricted bash shell, you would use the -r option

ex:- bash -r

then try to do something that you could do as a regular user, such as ls -a,

you will then see

bash: ls: no such file or directory

now my question is suppose i have my shell restricted, how to make it back un restricted ?


stachu dozzie

You can't. But you can search for a program, which can execute other programs. If you can't find out the rest, then you don't deserve unrestricted shell.


Lew pitcher

Assuming that you started the restricted shell from within the shell
bash -r
then all you have to do is exit to get back to your original shell


pk

I guess that if you'd be able to do that, then it would not be a "restricted" shell anymore.
However, according to the man page, if you are able to run a shell script using a command that does not contain "/", then the shell that runs that script is unrestricted. This can probably be exploited to somehow "escape" from the restrictions.

If you don't use the restricted shell as a login shell, just type "exit" to get back to the parent (unrestricted) shell.(btw, "ls -a" works fine for me even in a restricted shell)


pk

pk wrote:

>> now my question is suppose i have my shell restricted, how to make it
>> back un restricted ?

> I guess that if you'd be able to do that, then it would not be
> a "restricted" shell anymore.

Ok, it's actually very easy. Just edit your .bashrc or .bash_profile, and put "/bin/bash" in it. Logout, login, and you have an unrestricted shell. It's that simple. I suppose that, if the administrator wants to protect against that, he'll have to assign rbash with --noprofile and/or --norc as the user's shell.


Maxwell lol

There are ways to escape from sandboxes. the restricted shell is the
easiest to escape from.

For instance, start vi, and then execute a new shell from inside.


Mr C

If you changed your own shell to restricted, and have no access to another account in which to become root, you'll have to boot from a livecd / rescue CD to change it back. Since the restricted shell prevents you from specifing any command with a / in the pathname, and you can't change your PATH, you are stuck.


simon apnic

I don't advise you to use restricted bash shells..There are better choices like chroot, jail shells and others.And definitely you shouldn't do it to yourself, especially if you're using the root account (which many security experts don't recommend).

netcat

1)Port Scanning

netcat can also be used for port scanning (with zero-I/O option).

Code:

nc -v -z www.kernel.org 80 21

# or with port ranges

nc -v -z www.kernel.org 21-23


2. Remote Terminal

This example shows how to connect to a remote shell without using telnet or ssh. The terminal server which runs on :

Code:

nc -l -p 4000 -e /bin/sh

and the client :

Code:

nc 4000


3) File Transfer


Lets say you want to transfer a big zip file from machine A to machine B but neither one has FTP, and using email or IM is out of the question due to file size, or other restrictions. What do you do? You can use netcat as a makeshift file transfer software.

On machine B do the following, where 1337 is some unused port on which you want to send the file:

nc -lp 1337 > file.zipAssuming that the IP of machine B is 10.48.2.40 go to machine A and do:

nc -w 1 10.48.2.40 1337 < file.zip Thats it. The file will be magically transfered over the network socket.


4)Chat Server

Have you even needed an improvised one-on-one chat? Netcat can do that too. You simply start listening to connections on some port like this:

nc -lp 1337 Then on another machine simply connect to that port:

nc 10.48.2.40 1337 Now start typing on either machine. When you press enter, the line will immediately show up on the other machine.

OR

nc -l -n -v -p 555

on remote machine nc xxx.xxx.xxx.xxx [PORT]





5)Telnet Server

Nectat can also be used to set up a telnet server in a matter of seconds. You can specify the shell (or for that matter any executable) you want netcat to run at a successful connection with the -e parameter:

nc -lp 1337 -e /bin/bash On windows you can use:

nc -lp 1337 -e cmd.exeThen on a client machine simply connect to port 1337 and you will get full access to the shell, with the permissions of the user who ran nc on the server.


6 Web Server

I think this is my favorite trick. Did you ever need to set up simple makeshift webserver that would serve a single page? I know I did. In the past when my web server at work melted down, I set up laptop with this simple script:

while true; do nc -l -p 80 -q 1 < error.html; done

The error.html page was just a very simple error message notifying our users about the outage, and giving them an estimate of when it would be fixed. It took me 3 minutes to set up, and probably saved us many angry support calls.


source:- http://www.terminally-incoherent.com/blog/2007/08/07/few-useful-netcat-tricks/

Sunday, July 6, 2008

/etc/network/interfaces

the following are some of the lines in my /etc/network/interfaces file

auto lo
iface lo inet loopback
iface eth0 inet static

can any one explain what these lines are and what is their purpose ?

iface i know it means interface
eth0 - ethernet card 0
inet means what ?

what is meant by loopback , auto lo ?


nixscripter

"loopback" refers to an internal loopback network - 127.0.0.0/8
Loopback is a virtual interface which simply sends the packets from the local computer to itself. Leave that auto, as some daemons use it to for networking tricks, particularly RPC.


jamesapnic

The inet means that the interface will be used for "Internet" networking, i.e. using TCP/IP. Static means that it has been supplied with a fixed address and that is not, for example, using DHCP.


tredegar

and if you type man interfaces in a terminal, you can read a lot more about what the text in that file means.