Monday, October 31, 2011

Add new user in CentOS

Users can be created using user add command


useradd testuser

passwd testuser


Centos on MAC Mini

This post is about my experiences installing CentOS 6.0 on Mac Mini '07 model. Its an absolutely wonderful piece of hardware - 1.8Ghz, 2 G, 80GB. This had been running OSX for last 4 years and finally decided to move onto linux.

One of the problems with new OSX operating systems is they tend to run slower.

Steps to install:

1. Go to centos website and download 386 ISO ( i chose minimal edition can always install software and customize the environment)

This edition of mac mini runs on Core Duo chipset hence x86_64 is not supported.

2. Burn the ISO on a RW CD

3. Reboot the system and place the media on CD drive

4. Wait for a while until you see installer and follow the steps to install the application.

5. I chose to use the entire HD for linux, don't plan to run osx on this anymore

6. create users etc and reboot system.

Tuesday, October 25, 2011

Smoothwall mods

Lots of goodies at http://code.google.com/p/swemods/

Install modcommander to get a web install interface.

Mods installed on my Smoothwall Server:


Clamav
DHCP Lease
Enhanced DHCP mod
Smoothwall Backup
Vmwaretools

Connections & Ports in ESX & ESXi

An excellent port diagram for Vmware connectivity.

http://www.virtualinsanity.com/wp-content/uploads/connections-ports-esx.pdf

Saturday, January 29, 2011

HOWTO: Setup restricted directories on lighttpd

Restricted directories in lightttpd will be setup using mod_auth package and htpasswd.



if you don't already have htpasswd installed on your box do a apt-get

* apt-get install apache2-utils


Create password file

* htpasswd -c -m /etc/lighttpd/htpasswd

(Default encryption scheme is MD5)


Modify Lighttpd Config file

* vi /etc/lighttpd/lighttpd.conf

Add mod_auth on server.modules


server.modules              = (
            "mod_access",
            "mod_alias",
            "mod_accesslog",
            "mod_compress",
            "mod_auth"
}

Add following authorization module configurations

auth.backend = "htpasswd"
auth.backend.htpasswd.userfile = "/etc/lighttpd/htpasswd"
auth.require = ( "/directory-to-be-protected/" => (
                        "method" => "basic",
                        "realm" => "Access restricted to authorized users only",
                        "require" => "valid-user"
                )
)


Reload lighttpd configuration

/etc/init.d/lighttpd reload

Wednesday, December 29, 2010

Login to LINUX / Unix box using SSH without password

Here is a mini HOWTO to SSH onto a UNIX Box without typing password.


Server: LINUXSERVER (user --> linuxuser)
Client: iMAC ( user --> demouser)


  • Generate Authentication keys using ssh-keygen on client
$ ssh-keygen -t rsa 
Generating public/private rsa key pair.
Enter file in which to save the key (/home/demouser/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/demouser/.ssh/id_rsa.
Your public key has been saved in /home/demouser/.ssh/id_rsa.pub.
The key fingerprint is:
xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx demouser@iMAC
The key's randomart image is:
+--[ RSA 2048]----+
+-----------------+

  • Copy the id_rsa.pub to server onto $HOME_DIR/.ssh/authorized_keys2
  • Setup a symbolic link to authorized_keys
          ln -s authorized_keys2 authorized_keys
  • chmod 0600 on authorized_keys2 & authorized_keys file

Testing 

  • From the client try ssh linuxuser@linuxserver, ssh shouldn't ask for password. 

Monday, December 27, 2010

Disallow direct root logins via SSH

Permitting root login via SSH poses high risk, so its recommended to disable root login authentication via SSH.


Edit /etc/ssh/sshd_config and set the "PermitRootLogin" as "no". This will stop root login from using SSH.

Note: Ensure you have another ID setup to access the UNIX box, else you would be in trouble to reach the box.