A spanking new release of Google Earth is out. The latest 4.3 release
comes with Photo Realistic 3D modeling for buildings, “Swoop
navigation” for an improved navigation experience, “Light and shadow” to
catch sunrise and sunset from anywhere and finally the popular “Street
View” which was previously a Google Maps only feature.
Now something to excite Linux users, Google Earth is now available
for Linux. Not on WINE as but as a native application based on Qt and
openGL. I’m yet to try it but for those who have I have heard nothing
but good reviews with some minor glitches.
However Google Earth for Linux currently only supports the i386 architecture and seems to only work with 32bit processors.
The embedded video speaks for itself.
Download the latest Google Earth
Tuesday, November 27, 2012
How to limit ssh access to specific users or groups
Its sometimes necessary to limit who has access to a server via SSH.
Most Linux security hardening checklist today require this to be
enforced.
Fortunately this can be easily done with openSSH. Just edit the /etc/ssh/sshd_config file and add the desired directives shown below. You don’t need them all, just use what suits you needs.
openSSH provides 4 directives, AllowUsers, AllowGroups, DenyUsers and DenyGroups
Only users buddy, john and doe will be able to log in via ssh.
Only users within groups sysadmin and bkpadmin will be able to log in via ssh.
This is the opposite of AllowUsers. All users except for rambo and tina will be able to log in via ssh.
This is the opposite of AllowGroups. All groups except for hr and payroll will be able to log in via ssh.
Fortunately this can be easily done with openSSH. Just edit the /etc/ssh/sshd_config file and add the desired directives shown below. You don’t need them all, just use what suits you needs.
openSSH provides 4 directives, AllowUsers, AllowGroups, DenyUsers and DenyGroups
AllowUsers buddy john doe
Only users buddy, john and doe will be able to log in via ssh.
AllowGroups sysadmin bkpadmin
Only users within groups sysadmin and bkpadmin will be able to log in via ssh.
DenyUsers rambo tina
This is the opposite of AllowUsers. All users except for rambo and tina will be able to log in via ssh.
DenyGroups hr payroll
This is the opposite of AllowGroups. All groups except for hr and payroll will be able to log in via ssh.
How to send a process to the background
Sending a process to the background in Linux is quite easy. All you need is bg, fg, &, and ctrl+Z ( ^Z ).
For this example I will use a simple bash script test.sh I put together to print “Test” every 5 seconds.
Now let’s see how it’s done.
This starts test.sh and sends it to the background. You will be back at shell but should see the “Test” message every 5 seconds.
The jobs command will print all the background processes. Each process is represented by a number to it’s left. For example, tesh.sh is represented by 1.
The fg command will send the test.sh process to the foreground and return control to the shell.
The test.sh process is temporarily suspended.
The bg command will send test.sh to the background.
The jobs command will print all the background processes. Each process will be represented by a number to it’s left. tesh.sh is represented by 1.
The fg command will send the test.sh process to the foreground and return control to the shell.
That’s it.
For this example I will use a simple bash script test.sh I put together to print “Test” every 5 seconds.
#!/bin/bash
#This script will print "Test" every 5 seconds
#
while [ true ]
do
echo "Test at `date`"
sleep 5
done
#End
Now let’s see how it’s done.
[user@abubu root]$./test.sh &
This starts test.sh and sends it to the background. You will be back at shell but should see the “Test” message every 5 seconds.
[user@abubu root]$jobs
[1]+ Running ./test.sh &
The jobs command will print all the background processes. Each process is represented by a number to it’s left. For example, tesh.sh is represented by 1.
[user@abubu root]$fg 1
The fg command will send the test.sh process to the foreground and return control to the shell.
[user@abubu root]$ ./test.sh (hit ctrl+Z (^Z) now)
Test at Tue Jun 3 15:11:38 MYT 2008
[1]+ Stopped ./test.sh
The test.sh process is temporarily suspended.
[user@abubu root]$bg 1
The bg command will send test.sh to the background.
[user@abubu root]jobs
[1]+ Running ./test.sh &
The jobs command will print all the background processes. Each process will be represented by a number to it’s left. tesh.sh is represented by 1.
[user@abubu root]$fg 1
The fg command will send the test.sh process to the foreground and return control to the shell.
That’s it.
How to add route in Linux
To view the current routing table run “route -n”
To add a route refer to the command below.
To delete a route refer to the command below.
The routing information above is not persistent across reboots. After a reboot, the routing information will be lost and you need to add them in again.
To make the routing information persistent, add the “route add” line as seen above into the /etc/rc.local file.
Sample /etc/rc.local file.
[root@klmppswdr01p ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.41.42.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.41.41.0 10.41.42.8 255.255.255.0 UG 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 10.41.42.1 0.0.0.0 UG 0 0 0 eth0
To add a route refer to the command below.
"route add -net 10.41.41.0 netmask 255.255.255.0 gw 10.41.42.8"
To delete a route refer to the command below.
"route del -net 10.41.41.0 netmask 255.255.255.0 gw 10.41.42.8"
The routing information above is not persistent across reboots. After a reboot, the routing information will be lost and you need to add them in again.
To make the routing information persistent, add the “route add” line as seen above into the /etc/rc.local file.
Sample /etc/rc.local file.
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
route add -net 10.41.41.0 netmask 255.255.255.0 gw 10.41.42.8
How To Execute Linux commands from Windows
Most of the time, users are having a Windows Machine on their desk or
laptop. Normally, we want to perform a full scale data retrieval from
our Linux servers in the DC, where we don’t have a trusted Linux server
to manage it….the answer to it is use “PLINK” utility.
Plink comes together with the Putty…
A simple example of usage is:
C:> plink USERNAME@SERVERNAME ‘YOUR-LINUX-COMMAND’
If you have a dozen of servers…then you probably want to write a batch script in Windows to loop through a list of servers and mention the list of commands juz like what i did…..
Here a typical windows batch script:
@echo off
for / f “tokens=*” %%A in (your-server-list.txt) ( C:pathtoplink.exe user@server -w YOUR-PASSWORD -m linuxcommandscript > YOUR_OUTPUT_FILE.txt)
There you go, i did this for my sar report data collection for root cause analysis and infrastructure load analysis….keying in a password wif every darn login is impractical and yet you dont want to generate a security key for the servers.
Plink comes together with the Putty…
A simple example of usage is:
C:> plink USERNAME@SERVERNAME ‘YOUR-LINUX-COMMAND’
If you have a dozen of servers…then you probably want to write a batch script in Windows to loop through a list of servers and mention the list of commands juz like what i did…..
Here a typical windows batch script:
@echo off
for / f “tokens=*” %%A in (your-server-list.txt) ( C:pathtoplink.exe user@server -w YOUR-PASSWORD -m linuxcommandscript > YOUR_OUTPUT_FILE.txt)
There you go, i did this for my sar report data collection for root cause analysis and infrastructure load analysis….keying in a password wif every darn login is impractical and yet you dont want to generate a security key for the servers.
How to reset the root password for MySQL
It happens, you set a super complicated password for your MySQL root account and 2 months down the road forget what it was.
Here’s how you’d fix that.
1. Stop your current MySQL database if it is running
2. Start MySQL in safe mode and bypass reading the privilege table.
3. Reset your root password MySQL console. If it goes well you will not need to key in a password.
4. Kill the MySQL process and restart MySQL normally.
Here’s how you’d fix that.
1. Stop your current MySQL database if it is running
root@abubu# service mysqld stop
2. Start MySQL in safe mode and bypass reading the privilege table.
root@abubu# mysqld_safe --skip-grant-tables
3. Reset your root password MySQL console. If it goes well you will not need to key in a password.
root@abubu# mysql -u root mysql
mysql> update user set Password=PASSWORD('new-password');
mysql> flush privileges;
mysql exit;
4. Kill the MySQL process and restart MySQL normally.
How to build a local DNS caching server
Being in Malaysia we are gifted with superior Internet speeds. NOT!!
Services like openDNS are awesome but the lag between us and them often results in sluggish performance anyways.
One way to improve performance is to use local DNS servers. I don’t use Streamyx’s DNS servers because they SUCK!!. TIME’s DNS servers are ok but I still prefer openDNS.
To improve performance, I put together a local DNS caching-only server that forwards to openDNS. Now I have openDNS with lighting fast response.
Let’s walk though the steps to get your own local DNS caching-only server setup. I’m using openSUSE 11 so the steps might vary depending on your distro.
1. Install BIND
2. Edit /etc/named.conf
Uncomment the forwarders section. Update the default values with the values below.
Add the line ” forward only; ” This will tell BIND to only forward to the forwarders and not the ROOT servers.
3. Start the service.
To have the service start automatically run ”
4. Let’s make sure your caching server is running fine.
5. Update your /etc/resolv.conf file.
This will tell your system to use the local DNS server which we just setup instead of the external ones.
Add the lines below to the file.
That’s it. You now have local DNS caching. Enjoy!!
My /etc/named.conf file. Only the lines I changed.
# Enable the next entry to prefer usage of the name server declared in
# the forwarders section.
#forward first;
forward only;
Services like openDNS are awesome but the lag between us and them often results in sluggish performance anyways.
One way to improve performance is to use local DNS servers. I don’t use Streamyx’s DNS servers because they SUCK!!. TIME’s DNS servers are ok but I still prefer openDNS.
To improve performance, I put together a local DNS caching-only server that forwards to openDNS. Now I have openDNS with lighting fast response.
Let’s walk though the steps to get your own local DNS caching-only server setup. I’m using openSUSE 11 so the steps might vary depending on your distro.
1. Install BIND
pandora:~ # zypper in bind
2. Edit /etc/named.conf
pandora:~ # vi /etc/named..conf
Uncomment the forwarders section. Update the default values with the values below.
forwarders { 208.67.222.222; 208.67.220.220; };
forward only;
Add the line ” forward only; ” This will tell BIND to only forward to the forwarders and not the ROOT servers.
3. Start the service.
To have the service start automatically run ”
chkconfig named on
”pandora:~ # service named start
4. Let’s make sure your caching server is running fine.
pandora:~ # nslookup google.com localhost
Server:        localhost
Address:       127.0.0.1#53
Non-authoritative answer:
Name:  google.com
Address: 64.233.167.99
Name:  google.com
Address: 72.14.207.99
Name:  google.com
Address: 64.233.187.99
pandora:~ # nslookup yahoo.com localhost
Server:        localhost
Address:       127.0.0.1#53
Non-authoritative answer:
Name:  yahoo.com
Address: 68.180.206.184
Name:  yahoo.com
Address: 206.190.60.37
5. Update your /etc/resolv.conf file.
This will tell your system to use the local DNS server which we just setup instead of the external ones.
Add the lines below to the file.
nameserver 127.0.0.1
nameserver 127.0.0.2
That’s it. You now have local DNS caching. Enjoy!!
My /etc/named.conf file. Only the lines I changed.
#forwarders { 192.0.2.1; 192.0.2.2; };
forwarders { 208.67.222.222; 208.67.220.220; };
# Enable the next entry to prefer usage of the name server declared in
# the forwarders section.
#forward first;
forward only;
Subscribe to:
Posts (Atom)