[lf icon]

مقالات ومقتطفات قصيرة

Index:

Short articles can now be submitted directly online by everybody. Just click here and follow the instructions.


 

 

كيف تستخدم عدد من نسخ الارتباطات في نفس الوقت

بقلم: ماريو رافايل
ترجمة: ريم خالد

إذا كنت عادة تتعامل مع عدد كبير من مخدمات DNS  فإنك ربما تنسى أي نسخة من الروابط كنت تستخدم في كل واحد من هذه المخدمات . و لكن باتباع هذه الخطوات البسيطة ستتعلم  كيف يمكنك ان تعرف النسخة التي تستخدمها , و كيف تغيرها لتستعرض أي شيء تريده . و لعمل ذلك إبداء من عند nslookup و اكتب

server target.host > set  query=txt > set class=chaos > version.bind Server: localhost Address: 127.0.0.1 VERSION.BIND text = "8.2.3-REL"

و باستخدام الطريقة أعلاه سيكون من السهل أن تعرض على أصدقائك الرابط الحقيقي mastaH  الذي تستخدمه, و للانتفاع بشكل أكبر استخدم النص التالي #!/bin/bash for i in `cat iplist.txt`;do dig @$i txt chaos version.bind done   من الواضح الحاجة إلى إيجاد الملف المسمى iplist  و ذلك عند تحديد العناوين المعرفة لأسماء المخدمات التي تريد التأكد منها. والآن ننتقل إلى الجزء الأخر و هو تغيير نسخة الأرتباط التي ظهرت من خلال كتابة النص أعلاه . للقيام بذلك شغل المحرر المفضل لديك و اكتب /etc/named.conf  و في قسم الاختيارات اكتب شيئا مشابهاً ل : version ":******";  بعدها اعد تشغيل الرابط  عندها ستتغير نسخة الارتباط إلى النسخة التي تريد.

 


 
category: System Administration Language:English,  article number: 2001-03-08:1

Howto log in to your server passwordless via ssh ( rsa version )
by Murat Ilker Balaban , homepage: http://www.enderunix.org/

Create your private and public keys via ssh-keygen program
$ ssh-keygen
Computing keys
Testing the keys..
Key generation complete..
Enter the file in which to save the key (/usr/home/murat/.ssh/identity)

Press enter for the default value...

Your identification has been saved in /usr/home/murat/.ssh/identity
Your public ket is:
blah....blah...blah....
Your public key has been saved in /usr/home/murat/.ssh/identity.pub

Now that we have created our `public` key, take your
public key which is ~/.ssh/identity.pub to your server,
in the ~/.ssh/ directory, create a file named authorized_keys
and append the content of identity.pub file to your authorized_keys file
now, in your machine, type
$ ssh -l username your_remote_machine.domain.com
Boom, no password, no headache, you're in the other side...;)


 
category: UNIX Basics Language:English,  article number: 2001-02-13:9

Removing ^M from file
by Ismail YENIGUL , homepage: http://www.enderunix.org

if you have transferred a file from MS Windows to UNIX, you might find that the file looks like this:
bleh bleh ^M
leh leh ^M
tey tey tey^M

This is because Windows uses carridge return and newline to indicate a new line.
Here are a number of ways to get rid of the ^M characters:
1- cat filename1 | tr -d "^V^M" > newfile
2- sed -e "s/^V^M//" filename > outputfilename
where ^V is actually control-V and ^M is actually control-M (you must type these yourself, don't just copy and paste this command from this web page)
3-vi solution : open file with vi
   1. hit the ESC key
    2. :%s/^V^M//

3 - some distributions contain a command called dos2unix which removes these carridge return characters

4- use the texteditor vim (www.vim.org) and edit the file. If all the lines (not only some) contain consistently the carridge return characters then vim will show [textmode] and when you change the mode with the command
:set notextmode
it will remove them.



 
category: System Administration Language:English,  article number: 2001-02-13:5

Hide your Bind version
by Ismail YENIGUL , homepage: http://www.enderunix.org

Any user can get your bind version using following command:
$ nslookup -q=txt -class=CHAOS version.bind. remote.dns.server
Server: remote.dns.server
Address: 212.2.2.3
VERSION.BIND text = "8.2.2-P5"
to hide you version add folowing value to named.conf

version "[Secured !!! Please Go away idiot lamer ! ]";
in the options section as follows:
options {
directory "/var/named";
version "[Secured !!! Please Go away idiot lamer ! ]";
};

and restart your named. Finally when anyuser writes
$ nslookup -q=txt -class=CHAOS version.bind. remote.dns.server
Server: remote.dns.server
Address: 212.2.2.3
VERSION.BIND text = "Secured !!! Please Go away idiot lamer"
That's all


 
category: System Administration Language:English,  article number: 2001-02-08:1

How to delete and recreate /tmp
by Jordan

The directory /tmp is a special one. When you "stat" it, it shows a 1777 mod ie drwxrwxrwt. Well, it's the same for .X0-lock, .X11-unix and .font-unix.

    "t" means that the files in the directory can only be deleted by the owner even though the directory is world writable.

So after a "mv /tmp /no_more_room/tmp or a rm /tmp", just do:
  • mkdir /tmp
  • chmod 1777 /tmp

To re-create it with the correct permissions. You have to do that if you want your x font server (xfs) to be working properly.


 
category: Community Language:English,  article number: 2001-01-04:1

Mojolin, The Linux Job Site, goes international
by Dan Barber , homepage: http://mojolin.com

article image
Mojolin (http://www.mojolin.com) has added international support to its full featured online Job/Resume database. Job listings and resumes can now be entered with full location specifics. This new ability is complemented by a feature that allows an individual to search by countries, and by states and provinces in the United States and Canada. In addition, links have been provided to BabelFish for translation of the site into five different languages: German, French, Italian, Spanish and Portuguese. Other features include a nightly email agent which informs job seekers of the latest opportunities, and the ability for Webmasters to include Mojolin's job listings on their own sites.


 
category: System Administration Language:English,  article number: 2000-11-16:2

Blocking anyone to su to root
by Ismail YENIGUL , homepage: http://apache.cslab.itu.edu.tr

The su (Substitute User) command allows you to become other existing
users on the system. For example you can temporarily
become "root" and execute commands as the super-user "root". If
you don't want anyone to su to root or restrict "su" command to
certain users then add the following two lines to the top of
your "su" configuration file in the "/etc/pam.d/" directory.
1- Edit the su file (vi /etc/pam.d/su) and add the following two
lines to the top of the file:

auth sufficient /lib/security/pam_rootok.so debug 

auth required /lib/security/pam_wheel.so group=wheel 

After adding the two lines above, the "/etc/pam.d/su" file should
look like this:
#%PAM-1.0
auth sufficient /lib/security/pam_rootok.so debug
auth required /lib/security/pam_wheel.so group=wheel

auth required /lib/security/pam_pwdb.so shadow nullok
account required /lib/security/pam_pwdb.so
password required /lib/security/pam_cracklib.so
password required /lib/security/pam_pwdb.so shadow use_authtok nullok
session required /lib/security/pam_pwdb.so
session optional /lib/security/pam_xauth.so
Which means only those who are a member of the "wheel" group can su to root;
and to add a user to wheel group use:
root# usermod -G10 username

Ok, now everybody can not be root using su. When an user that is not in wheel group runs su command ,he/she can not be root even if he/she writes correct root password.


 
category: System Administration Language:English,  article number: 2000-11-16:1

Disable rreboot,halt ,shutdown for users
by Ismail YENIGUL , homepage: http://apache.cslab.itu.edu.tr

On Redhat
[root@apache /]# rm -f /etc/security/console.apps/halt
[root@apache /]# rm -f /etc/security/console.apps/poweroff
[root@apache /]# rm -f /etc/security/console.apps/reboot
[root@apache /]# rm -f /etc/security/console.apps/shutdown
[root@apache /]# rm -f /etc/security/console.apps/xserver (if removed, root will be the only user able to start X).


 
category: UNIX Basics Language:English,  article number: 2000-10-09:1

Create /dev/null
by Mariusz Zinowicz

I have moved a file to /dev/null and now my system doesn't work

If you move a file with the mv command to "/dev/null" then it will be overwritten with an ordinary file.
How to fix it:
Boot your system. If it doesn't boot take a one disk distribution like Toms rtbt and mount your /dev/hdXX partition.
Now type in a shell "mknod /dev/null c 1 3" to create a nod file. /dev/null is the path where the nod file will be saved. The c stands for a character device and the two numbers are the major and the minor numbers for the null device.
After that you must change with "chmod 666 /dev/null" the read, write and execute permissions.

With "ls -alF /dev/" you will see all nod files with it's own three parameters like
"crw-rw-rw- 1 root root 1, 3 Oct 4 11:34 null ".
You will see a "c" in the near of the rwx flags an a " 1, 3" left of the date.


 
category: UNIX Basics Language:English,  article number: 2000-05-19:1

How to create many subdirectories in one time
by Pascal Mulier

Sometimes, we want to create 2 or 3 (or more) directories at the same time.
For example, you are in "rep1" directory ("rep1" doesn't contain any subdirectory) and want to create rep1/rep2/rep3
With "p" option of the mkdir command , it's very easy :

mkdir -p rep1/rep2/rep3


 
category: Webdesign Language:English,  article number: 2000-04-10:1

Translating articles from/to English, French, German and Spanish from within Netscape.
by Egon Willighagen

Webpages can conveniently be translated from English to French, Italian, German, Spanich and Portoguese or visa versa by means of Babelfish.

Altavista has a website where you can have a text translated. Alternatively you can have a website translated.

If you add the link below to your bookmarks (name it "translate"), you can translate any page by choosing this "translate" bookmark while visiting a website:

 
javascript:location.href=
'http://babelfish.altavista.com/cgi-bin/
translate?jss&urltext='+escape(window.location);
The above should be written as one line. I just split it into a couple of lines for easy reading.

Translations are not very good, but it will give a very good clue about the content of the page.

An other interesting site for online translation is www.freetranslation.com.



 
category: Applications Language:English,  article number: 2000-03-24:2

How to ispell a german text file?
by Dino Korn

Solution:
ispell -T latin1 -d deutsch textfile.txt
The -T latin1 causes ispell to handle Umlaute correctly.


 
category: UNIX Basics Language:English,  article number: 2000-03-24:1

How to easily shutdown your Linuxbox without beeing root?
by Bernd Muller

People who do not boot to run-level 5 (grapical login) but use normal startx to start the window system I have the following trick:

Edit /etc/inittab and search for ctrlaltdel
ca::ctrlaltdel:/sbin/shutdown -t1 -r now
Replace the -r by -h:
ca::ctrlaltdel:/sbin/shutdown -t1 -h now
After that reboot once. Now you can shutdown and halt your computer by typing CTRL-ALT-DELETE. And this can be done by anybody without root rights.


 
category: UNIX Basics Language:English,  article number: 2000-03-01:2

How to delete all files from /tmp?
by Katja Socher

Simple question? Well, how do you delete files in directories that start with a dot in the name?
Rm -r /tmp/.* WILL DELETE THE WHOLE DISK as it selects also the file /tmp/.. Therefore never try this. The solution is to add two question marks before the '*'-wildcard:

rm -rf /tmp/.??* /tmp/*

You can put this into /etc/rc.d/init.d/syslog into the "stop)" section. This will clean up /tmp at every shutdown and keep your disk tidy.
Do not run the above command while running X11 or before you run startx. X11 needs the /tmp/.font-unix which is created by xfont server and X11 it self creates the directory /tmp/.X11-unix which is needed to talk to the X11 windows.


 
category: Kernel Corner Language:English,  article number: 2000-03-01:1

How to make Linux ignore a ping?
by Antonio Schifano

Sometimes it can be useful to hide a Linux machine a bit. Here is how you can make Linux ignore a ping:

Simple, to turn answers to icmp_echo off type:
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
to turn it on again use:
echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all



 
category: UNIX Basics Language:English,  article number: 2000-02-15:3

Resetting your terminal/shell window
by Guido Socher , homepage: http://www.oche.de/~bearix/g

When accidentally doing a :
cat /bin/somefile_binary
you can end up with a "broken terminal". The binary file may possibly contain characters that put a terminal into a mode where the output becomes unreadable. To put the terminal back to normal you can type
/bin/echo -ne "\017"
To make it easier you can put this into a small shell script and call it kscreen. When your terminal is again in this funny mode you just type blindly kscreen and it is back to normal.


 
category: UNIX Basics Language:English,  article number: 2000-02-15:2

Finding out what libraries a program requires
by Guido Socher

  1. First find out where the program is located:
    In bash use: type yourprogram
    In tcsh use: which yourprogram

  2. To find out which shared libraries a program requires, type:
    ldd /the/path/to/yourprogram

Example:
> which gnome-terminal
/usr/bin/gnome-terminal

> ldd /usr/bin/gnome-terminal
        libart_lgpl.so.2 => /usr/lib/libart_lgpl.so.2 (0x400e1000)
        libgdk_imlib.so.1 => /usr/lib/libgdk_imlib.so.1 (0x400ef000)
        libgtk-1.2.so.0 => /usr/lib/libgtk-1.2.so.0 (0x40131000)
        libgdk-1.2.so.0 => /usr/lib/libgdk-1.2.so.0 (0x40251000)
        libgmodule-1.2.so.0 => /usr/lib/libgmodule-1.2.so.0 (0x40283000)
        libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x40286000)
        libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x40292000)
        libgnome.so.32 => /usr/lib/libgnome.so.32 (0x4032f000)
        libgnomesupport.so.0 => /usr/lib/libgnomesupport.so.0 (0x40345000)
        libaudiofile.so.0 => /usr/lib/libaudiofile.so.0 (0x40350000)
        ....

 
category: UNIX Basics Language:English,  article number: 2000-02-15:1

Mtools
by Guido Socher , homepage: http://www.oche.de/~bearix/g

article image
mtools is a collection of programs to access ms-dos files on floppy disks without mounting them. You can read dos floppy disks in Linux by mounting them somewhere but mtools are usually easier and faster to use. An advantage is also that the floppy does not need to be mounted because accidentally ejecting a mounted floppy under Linux can be quite fatal.

Using mtools

mtools work basically like msdos commands. The command names are identical with the corresponding msdos command except that a "m" is prepended. Mtools understand also long file names. The most important commands are:
  • mcopy
  • mdel
  • mdir
  • mformat
Make sure that the device /dev/fd0 is writable for you before you use them. You many make the /dev/fd0 device writable for everybody. To do that log in as root and type "chmod 666 /dev/fd0".

To get a directory listing of the floppy in /dev/fd0 (drive a:) you type:
mdir a:
Note the device specifier. It is "a:" and not the normal Linux name /dev/fd0.

To copy the files a.txt and b.txt to the floppy you use:
mcopy a.txt b.txt a:


To copy all files (not directories) from the floppy to your current directory you use:
mcopy "a:*" .
Note the quotes. They are important because you want the star to go to the mcopy command and avoid that it gets expanded by the shell.

To delete all files that have a filename which starts with a "x" you type:
mdel "a:x*"
Again remember to put quotes.

To remove all files from the floppy you can use mformat
mformat a:

The mtools are included in almost every distribution. If they are not yet installed then install them from cdrom. Otherwise mtools are available from
http://www.tux.org/pub/tux/knaff/mtools/index.html


 
category: UNIX Basics Language:English,  article number: 2000-02-14:5

Colors in the command prompt
by Guido Socher

article image
All terminal windows for Linux understand Ansi color codes and with these codes it is possible to have colors in the shell prompt.

The color codes are:

  • Foreground colors: 30=black, 31=red, 32=green, 33=yellow, 34=blue 35=purple, 36=turquoise, 37=white
  • Background colors: 0=transparent, 40=back, 41=red, 42=green, 43=yellow, 44=blue 45=purple, 46=turquoise, 47=white
The syntax to print the codes is "Esc[background;foreground;1m" for bold print and "Esc[background;foreground m" for normal print. The Esc is a literal Esc character (octal 33). The coloring is switched off with "Esc[m"

This command prints e.g Linux in yellow on a red background:
/bin/echo '\033[41;33;1m Linux \033[m'
Just try it out copying the command into the next shell.

To insert special characters such as (a literal Esc) into the shell prompt you must include them in %{ %} for tcsh and \[ \] for bash

This gives e.g the tcsh prompt that you can see in the picture above:
set prompt='%{^[[44;33;1m%}%!\-%n@%m%{^[[m%} \n%{^[[44;37;1m%}(%~)%#%{^[[m%} '

A yellow prompt for bash is e.g:
PS1='\[^[[40;33;1m\]\u@\h:\w\$\[^[[m\] '

In both cases the literal Esc character is shown as ^[. Note: You can not copy and paste these lines from the web browser to the shell. To get a literal Esc in Vi you type crtl-v Esc and in Emacs this is crtl-q Esc.

Happy color command prompts!



 
category: UNIX Basics Language:English,  article number: 2000-02-14:1

2 vi tricks
by Guido Socher , homepage: http://www.oche.de/~bearix/g

article image
Here are 2 interesting tricks for the VI editor.

  1. While editing something in VI you suddenly get a phone call. You need to go to the shell type a few commands and then go back to VI and continue working. What do you do? It's easy with VI. Hit Crtl-z to suspend VI then type the commands and afterwards type fg to continue the suspended VI process in foreground.

  2. The commands in makefiles must be preceded by a tab-character. Unfortunately it is not easy to distinguish tabs from spaces but a makefile with spaces just wont work. In VI you just type:
    :set list
    to see the tab characters as ^I. This way you can see all tabs at once and verify that the makefile is correct. When done you type:
    :set nolist


 
category: Webdesign Language:English,  article number: 2000-02-13:1

Finding Netscape bookmarks
by Guido Socher , homepage: http://www.oche.de/~bearix/g

article image

Searching through bookmarks

Sometimes you are looking for a bookmark in netscape and you can only remember that the URL or title did contain some key word. A little perl script, I called it showbook, can help in that case.

showbook linux
does e.g list all your bookmarks that contain the string Linux somewhere.

Click here to download the script.
(Note: If you download the script under windows then you must convert the dos textfile first to a unix textfile before it will run under Linux.)

Copy paste a url while not online

Somehow it is not possible to copy/paste a URL from your bookmark list into an other program. You can click on the bookmark go to the page and then copy the URL from the location entry at the top of the window in netscape. The problem is that you need to be online to do that. Again the above showbook program helps. It just lists the URL in the terminal window and you can easily copy/paste from there.