Browsing articles tagged with " debian"
Oct 30, 2011
jason

How to install sshd and config for authentication with private key only

Once the system is up and running, the first thing for most linux system admin to do is to install sshd and configure authentication. Nowadays, most IT companies will not allow password based authentication anymore. Most coporate environment favours ssh key based authentication. Of course, there are hundreds of different methods to do this. Here is one of my favourite and simplest guide.

I’ve assumed you use Debian based linux and logon under root. If you are using other linux, change the command to yum or whatever package management system you used.

  • First install ssh server.
  • ~$apt-get install openssh-server

  • Edit sshdconfig file
  • ~$vi /etc/ssh/sshd_config

  • Disable password authentication by putting the following line
  • PasswordAuthentication no

  • For keys file location, I prefer to put in file by user name
  • AuthorizedKeysFile /etc/ssh/keys/%u

  • Save the file
  • Copy the public key of the users and put in /etc/ssh/keys/
  • Restart the ssh demon by entering the following command
  • /etc/init.d/ssh restart

That’s it! Your users need to use their private key to login to the server from now on.

Source : OpenBSD

Oct 28, 2011
jason

How to resolve “Can’t locate DBD/Pg.pm” error

I was having the following perl module missing error.

root@SUNNYVALE-133:/# ./myscript.pl
Can’t locate DBD/Pg.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at ./myscript.pl line 5.
BEGIN failed–compilation aborted at ./myscript.pl line 5.

After googling for a while, most websites directed me to do the following.

$cpan
cpan>install DBI
cpan>install DBD::Pg

Even after I’ve done that, I’m still having the same error message. Eventually I’ve found out that since I’m using Debian, I should rather just install the perl pg library. The following command is the one that solve my problem.

root@SUNNYVALE-133:/#apt-get install libdbd-pg-perl

I hope this would be helpful to you as well if you’re getting the same error message.

Source : Perl DBI Support

Sep 15, 2011
jason

Change hostname in Ubuntu or Debian

If you’ve changed your mind about your Linux hostname or you’ve set to wrong hostname, here is how to fix it.

Firstly, I’ve tried the following command:

$sudo hostname mybrandnewname

But this will revert back to prior hostname whenever the machine reboots. So how can you change it permanently? First you’ll need to edit /etc/hostname file

$sudo vi /etc/hostname Then delete the old name and type whatevername you desire

It is also advisable to change new hostname in /etc/hosts file

Source : UbuntuManual