Archive for August, 2007 Page 4 of 6



Secure shell (ssh) connection without password

Welcome to Linux Screw! If you're new here, you may want to subscribe our RSS feed.

Let’s assume we have two Linux running machines, one of them is ‘client’ and other is ’server’. Task lies in allowing client to access server via ssh securely without a need to type password by hands. It’s usually useful to perform some operations that are to be done without user intervention (for example copying backup data files from client to server through ’scp’).First of all it’s necessary to make sure that server we’re going to access to supports public key authentication. To enable it just add lines ‘RSAAuthentication yes’ and ‘PubkeyAuthentication yes’ to /etc/ssh/sshd_config at server machine. After that restart ssh daemon (sshd) by executing command ‘/etc/init.d/ssh restart’ or ’service ssh restart’ (depends on Linux distribution you use).

After it’s done we should generate public RSA key at client machine and copy it to the list of authorized keys at server.

At client machine execute (leave passphrase empty):

ssh-keygen -t rsa

this would create public key at /home/your_login/.ssh/id_rsa.pub.

Then copy generated key to server (for example by ’scp’ command):

scp /home/your_login/.ssh/id_rsa.pub server_login@server_ip_address:/tmp

After client’s public key is copied to /tmp/id_rsa.pub, login to server and perform the following operation. Add client’s key to authorized keys list by executing command:

mkdir /home/server_login/.ssh #only if it’s needed

cat /tmp/id_rsa.pub >> /home/server_login/.ssh/authorized_keys

When it’s done try to login to server from client:

ssh server_login@server_ip_address

Please note it’s important to copy client’s public key to user’s directory you’re going to login with (in this example it’s sever_login).

Good luck, mates!

Little update: it’s also necessary to uncomment lines in /etc/ssh/sshd_config at server:

RSAAuthentication yes
PubkeyAuthentication yes

And then restart ssh daemon e.g. by command:

/etc/init.d/ssh restart

Fun: Open source girls… :)

Find more here.

Access to sqlite3 database through perl (script example)

By publishing this post I try to help people who want to get access to popular and simple database engine sqlite through perl script. I use sqlite to store e-mails statistics at small mail server in order to retrieve information about users’ mail activity like average response time, sent and received messages and etc. There is perl script that is used to get this data per every user or get summary statistics. This script is to be run by web server (I use Apache) and has name index.cgi in my case.

Here is part of it:

#!/usr/bin/perl
use DBI;
print “Content-type: text/html\n\n”;
print “<html><head><title>perl and sqlite example script</title></head><body>”;
$dbh = DBI->connect( “dbi:SQLite:dbname=/tmp/mail_data.db”,”", “”, { RaiseError => 1, AutoCommit => 0 });

my $fst = $dbh->selectall_arrayref(”SELECT min(time_1),max(time_1) FROM mail_data”);
foreach my $row (@$fst) {
my ($fst_pr,$lst_pr) = @$row;
print “oldest entry in database: “.gmtime($fst_pr).” gmt<br>newest entry in database: “.gmtime($lst_pr);
}

print “</body>”;
print “</html>”;
$dbh->disconnect;

After you load this example through any web browser (please read your web server’s manual on how to allow cgi/perl script exec, for example here), script will read sqlite database that is located at /tmp/mail_data.db and display minimal and maximal values of field time_1 from mail_data table.

In order to run this script it’s necessary to install perl, sqlite3 and perl-DBI-SQLite cpan module.

You may also be interested in:
CGI Perl scripts debugging (solve 500 Internal Server Error)

Linux networking stack understanding

M. Tim Jones, Consultant Engineer, Emulex Corp.:

One of the greatest features of the Linux® operating system is its networking stack. It was initially a derivative of the BSD stack and is well organized with a clean set of interfaces. Its interfaces range from the protocol agnostics, such as the common sockets layer interface or the device layer, to the specific interfaces of the individual networking protocols. This article explores the structure of the Linux networking stack from the perspective of its layers and also examines some of its major structures.

Anatomy of the Linux networking stack by IBM.

Fun: Bill Gates recommends Ubuntu :)

Picture found here.

Top 7 iPod managing tools for Linux and Mac

Here is a list of iPod managing tools for Linux and Apple Mac. You can find detailed review of these tools here.

Amarok
Banshee
Floola
gtkpod
Rhythmbox
Songbird
YamiPod

Lingvo dictionaries with Stardict

I think that the best open source off-line dictionary is Stardict. It’s absolutely free, it’s very user friendly and, of course, it supports a huge amount of dictionaries which allow to translate words and phrases into many directions.

Few will deny that there is no better Russian-English and English-Russian dictionary than Lingvo, but shame on it’s developers — it’s for Window$ only. This problem can be solved rather simply by using Lingvo dictionaries with Stardict… Here are links for EN-RU and RU-EN dictionaries:

http://rapidshare.com/files/45302592/Lingvo11_EN-RU.tar http://rapidshare.com/files/45303408/Lingvo11_RU-EN.tar

I use them by myself at my Ubuntu laptop and they are very easy to install. Just install startdict by command sudo apt-get install stardict (for Ubuntu and Debian) or yum install stardict (Fedora, CentOS, RedHat etc.). The unpack them into /usr/share/stardict/dic and restart Stardict. Here are results:

Stardict and Lingvo dictionaries




Information Improvisation: Operating system is the backbone for every organization. Having professionals with CISSP certification in organization ensures the life running through its networks. Organizations manage tremendous amounts of traffic due to the use of pc phone and people with 646-058 certifications are ideal for this job. They can also manage online networks which can be hosted on lunarpages, which also provides free email hosting. With the company's logo design every page and a well crafted web template the site can be given a graceful look.

 

Friendly Sites:Who is behind Linux Screw?
Aspiring Sysadmin | GeekyBits³ | Bash Cures Cancer | TOTMS
Linux Operating System | Small Linux Deployments | My SysAd Blog
The Danesh Project | ZEPY | Linux config Wiki | Planet Sysadmin
The Sys Admin | {buhay sysad} | a non-geek's linux notes
Linux HOWTOs, Tutorials & Projects with Adam Palmer | LinuxAlt.Com
My name is Artem Nosulchik (artiomix AT gmail DOT com) and I'm Linux/Unix, Cisco systems engineer. The main idea of Linux Screw is to share relevant knowledge, skills and observations over The Web. Here you can find a lot of information related to different Linux distributions, FreeBSD, IOS as well as a other Open Source around staff. Read more ››