Set Time Zone + Fedora 18
[root@dlp ~]# timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
Africa/Blantyre
Africa/Brazzaville
Africa/Bujumbura
Africa/Cairo
Africa/Casablanca
Africa/Ceuta
Africa/Conakry
Africa/Dakar
Africa/Dar_es_Salaam
Africa/Djibouti
Africa/Douala
[root@dlp ~]# timedatectl status
# show current settings
Local time: Mon 2013-04-15 10:51:47 IST
Universal time: Mon 2013-04-15 05:21:47 UTC
RTC time: Mon 2013-04-15 05:21:47
Timezone: Asia/Kolkata (IST, +0530)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
[root@dlp ~]# timedatectl set-ntp true
#Enable an NTP daemon (chronyd):
Fedora 17 + Tata Photon (Huawei)
Connect Photon
# lsusb | grep -i HUAWEI
Bus 001 Device 006: ID 12d1:140b Huawei Technologies Co., Ltd. EC1260 Wireless Data Modem HSD USB Card
See whats in bold
Go in directory
# /etc/usb_modeswitch.d
# vi 12d1\:140b
# Huawei E180
TargetClass=0xff
HuaweiMode=1
DefaultVendor= 0x12d1
DefaultProduct=0x140b
TargetVendor=0x12d1
TargetProduct=0x140b
MessageContent=”55534243123456780000000000000011062000000100000000000000000000″
# usb_modeswitch -I -W -c 12d1:140b
Reading config file: 12d1:140b
* usb_modeswitch: handle USB devices with multiple modes
* Version 1.2.3 (C) Josua Dietze 2012
* Based on libusb0 (0.1.12 and above)
! PLEASE REPORT NEW CONFIGURATIONS !
DefaultVendor= 0x12d1
DefaultProduct= 0x140b
TargetVendor= 0x12d1
TargetProduct= 0x140b
TargetClass= 0xff
TargetProductList=””
DetachStorageOnly=0
HuaweiMode=1
SierraMode=0
SonyMode=0
QisdaMode=0
GCTMode=0
KobilMode=0
SequansMode=0
MobileActionMode=0
CiscoMode=0
MessageEndpoint= not set
MessageContent=”55534243123456780000000000000011062000000100000000000000000000″
NeedResponse=0
ResponseEndpoint= not set
InquireDevice disabled
Success check disabled
System integration mode disabled
Looking for target devices …
searching devices, found USB ID 8087:0020
searching devices, found USB ID 1d6b:0002
searching devices, found USB ID 138a:0007
searching devices, found USB ID 12d1:140b
found matching vendor ID
found matching product ID
target class ff matching
adding device
# nm-connection-editor
Create a new mobile broadband connection . Select Tata Photon Plus.
Connection NO : #777
Username : internet
password: internet
Fedora 17: Install OpenSSH Server
How to install the OpenSSH Server on Fedora 17 for remote access.
Open a terminal, become root and install the software.
# su -
# yum install -y openssh-server
Use existing user that need to be allowed to SSH remotely (eg someuser someuser2).
Now, edit /etc/ssh/sshd_config and add the following.
PermitRootLogin no
AllowUsers
someuser someuser2
The above will disable logins for root and only permit connects from someuser someuser2.
And finally, enable and start the SSH service.
systemctl enable sshd.service
systemctl start sshd.service
Change the default keyring password
So you forgot the keyring password (hey happens to all of us at some point of time).
here’s what I did
$ cd .gnome2/keyrings/
$ rm -rf *
restarted application that was asking for the password and was ready to go.
Error: Could not stat() command file ‘/usr/local/nagios/var/rw/nagios.cmd’!
if you encounter this:
Error: Could not stat() command file ‘/usr/local/nagios/var/rw/nagios.cmd’!
try testing your selinux settings
start with:
setenforce 0
this will disable for now
Or else check permissions on file
chown nagios.nagcmd /usr/local/nagios/var/rw
chmod g+rwx /usr/local/nagios/var/rw
chmod g+s /usr/local/nagios/var/rw
Gnone 3.X adding personal launcher
Wanted to add Firefox as a personal launcher here’s a sample of what I did
$ cat /usr/share/applications/firefox.desktop
[Desktop Entry]
Version=14.0.1
Name=Mozilla Firefox
Comment=Firefox Web Browser
GenericName[en]=Firefox
Terminal=false
Exec=/usr/bin/firefox
Icon=/data/esentails/firefox/icons/mozicon128.png
Type=Application
X-MultipleArgs=false
Categories=Application;Internet;
MimeType=text/plain;
InitialPreference=5
StartupNotify=true
It should show up in your gnome overview and then you’ll be able to drag it as a favorite.
Gnome 3.x Change Panel
To change color of gnome 3.x panel
$ vi /usr/share/gnome-shell/theme/gnome-shell.css
search for
/* Panel */
#panel {
background-color: black;
font-weight: bold;
height: 1.86em;
}
I changed
background-color: grey;
But I’m sure you could also try a
border-image: url("border.png");
and play with opacity .
save the file reload the gnome3 desktop by hitting
Alt+F2
then enter
r
hit
Enter
KDE remove autostart programs
Had a situation where kde was starting programs automatically on restart.
Found the file
/home/user/.kde/share/config/ksmserverrc
Edited this file to disable autostart of programs on logout
GPS on Linux
Compile kernel with usb-modem feature
Connect the GPS to usb port ….
Check /var/log/messages
$ tailf /var/log/messages
Jun 20 22:26:39 localhost kernel: usb 6-2: new full speed USB device using uhci_hcd and address 3
Jun 20 22:26:40 localhost kernel: usb 6-2: configuration #1 chosen from 1 choice
Jun 20 22:26:40 localhost kernel: cdc_acm 6-2:1.0: ttyACM0: USB ACM device
Device created is ttyACM0
This should give you a continuous stream
$ cat /dev/ttyACM0
$GPRMC,071601.00,A,1907.09660,N,07252.30735,E,0.029,235.62,130711,,,A*67
$GPGGA,071601.00,1907.09660,N,07252.30735,E,1,09,2.21,33.2,M,-62.8,M,,*40
$GPGSV,3,1,12,13,82,086,34,20,11,177,35,19,43,072,35,10,25,274,*77
$GPGSV,3,3,12,07,40,343,15,11,20,137,31,08,25,316,10,28,32,250,*7A
$GPZDA,071601.00,13,07,2011,00,00*60
Now that the device is detected lets install the rpms required
$ yum install -y gpsd gpsd-clients
Incase Not created Please create
Created startup script
$ cat /etc/init.d/gpsd
#!/bin/sh
#
# gpsd Service daemon for mediating access to a GPS
#
# chkconfig: – 44 66
# description: gpsd is a service daemon that mediates access to a GPS sensor \
# connected to the host computer by serial or USB interface, \
# making its data on the location/course/velocity of the sensor \
# available to be queried on TCP port 2947 of the host computer.
# processname: gpsd
# pidfile: /var/run/gpsd.pid
# http://fedoraproject.org/wiki/FCNewInit/Initscripts
### BEGIN INIT INFO
# Provides: gpsd
# Required-Start: network
# Required-Stop: network
# Should-Start:
# Should-Stop:
# Default-Start:
# Default-Stop:
# Short-Description: Service daemon for mediating access to a GPS
# Description: gpsd is a service daemon that mediates access to a GPS sensor
# connected to the host computer by serial or USB interface, making its
# data on the location/course/velocity of the sensor available to be
# queried on TCP port 2947 of the host computer.
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
exec=”/usr/sbin/gpsd”
prog=$(basename $exec)
PIDFILE=/var/run/gpsd.pid
CONTROL_SOCKET=/var/run/gpsd.sock
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
: ${OPTIONS:=-n}
: ${DEVICE:=/dev/ttyACM0}
lockfile=/var/lock/subsys/$prog
start() {
[ “$EUID” != “0” ] && exit 4
echo -n $”Starting $prog: ”
daemon $exec -P $PIDFILE -F $CONTROL_SOCKET $OPTIONS $DEVICE
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
[ “$EUID” != “0” ] && exit 4
echo -n $”Stopping $prog: ”
killproc $prog
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
stop
start
}
case “$1” in
start|stop|restart)
$1
;;
force-reload)
restart
;;
status)
status $prog
;;
try-restart|condrestart)
if status $prog >/dev/null ; then
restart
fi
;;
reload)
status $prog >/dev/null || exit 7
# If config can be reloaded without restarting, implement it here,
# remove the “exit”, and add “reload” to the usage message below.
action $”Service $prog does not support the reload action: ” /bin/false
exit 3
;;
*)
echo $”Usage: $0 {start|stop|status|restart|try-restart|force-reload}”
exit 2
esac
$ echo “/etc/init.d/gpsd start ” >> /etc/rc.local
Or start it via services
Graphic front end
$ /usr/bin/xgps
Running cgps utility, I can obtain the following (You will know where I am by interpreting the Lat/Lon). cgps runs on serial or console terminal and connects to local port 2947, which is the default port that gpsd listened to for serving queries from client programs:
$ cgps localhost 2947
CGPS Test Client
┌───────────────────────────────────────────┐┌─────────────────────────────────┐
│ Time: 2011-07-13T06:27:43.00Z ││PRN: Elev: Azim: SNR: Used: │
│ Latitude: 19.118427 N ││ │
│ Longitude: 72.871813 E ││ │
│ Altitude: 50.3 m ││ │
│ Speed: 0.0 kph ││ │
│ Heading: 356.4 degrees ││ │
│ HPE: 8 m ││ │
│ VPE: 13 m ││ │
│ Climb: 0.0 m/min ││ │
│ Status: 3D FIX ││ │
│ Change: 0 secs ││ │
│ ││ │
│ ││ │
└───────────────────────────────────────────┘└─────────────────────────────────┘
┌───────────────────────────────────────────┐
│Command: │
└───────────────────────────────────────────┘
GPSD,O=GGA 1310538463.00 0.005 19.118427 72.871813 50.30 ? ? 356
.4500 0.011 0.000 ? ? ?
GPSD,O=GSA 1310538463.00 0.005 19.118427 72.871813 50.30 8.32 13.20 356.4500
0.011 0.000 165.6961 16.64 ?
There are two more native way to interact with gpsd for retrieving GPS data – by telnet or gpspipe. Since gpsd listen to port 2947, you can just “telnet” to it. Once connect, type ‘p’ or ‘d’ followed by return will query for position and time respectively
$ telnet localhost 2947
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
p
GPSD,P=19.118280 72.871878
d
GPSD,D=2011-07-13T06:33:19.00Z
$ gpspipe -r localhost 2947
GPSD,R=1
$GPGSV,4,2,14,10,25,287,14,32,05,165,,06,16,048,33,23,63,124,48*70
$GPGSV,4,3,14,03,29,054,35,07,36,330,,16,08,039,,08,20,305,29*74
$GPGSV,4,4,14,11,15,147,,28,25,239,26*7B
$GPGLL,1907.09502,N,07252.31343,E,065047.00,A,A*6C
$GPZDA,065047.00,13,07,2011,00,00*61
Setting up time via gps
#!/bin/bash
#setup time via gps
i=0;
while [ “$i” -lt 5 ];
do
sleep 5
(echo d ; sleep 1; echo d; sleep 1; echo d) | (nc localhost 2947) > /tmp/gps_time &
TEST=$!
sleep 4
kill -s SIGINT $TEST
i=$(($i+1))
date=$`cat /tmp/gps_time | tail -n 1`
year=$(echo $date | sed ‘s/.*D=\([0-9]*\)-.*/\1/’)
[ “$year” -gt 2004 ] && break
done;
echo “slept $i times while waiting gps lock..”
echo “Setting date $date”
export TZ=UTC
date $(echo $date | sed ‘s/GPSD,D=\([0-9]*\)\(.*\):.*/\2\1/’ | sed ‘s/[^0-9]//g’)
sleep 2
export TZ=”/usr/share/zoneinfo/Asia/Calcutta”
add3sec=`date –date=’3 seconds’`
date -s “${add3sec}”
date
hwclock –systohc
hwclock
Getting Location via bash
#!/bin/bash
#setup time via gps
i=0;
while [ “$i” -lt 5 ];
do
sleep 5
(echo dp ) | (nc localhost 2947) > /tmp/gps_location &
TEST=$!
sleep 1
kill -s SIGINT $TEST
i=$(($i+1))
echo $i
done;
echo “slept $i times while waiting gps lock..”
cat /tmp/gps_location| \
awk -F “P=” ‘{ print $NF}’ | \
awk ‘{ print “Latitude: ” $1 ” Longitude: ” $2}’
Debian Squeeze change root password
== Method 1 ==
Boot into grub, select single user but do not press enter.
Press e to bring you into edit mode.
Scroll down to the kernel line, it starts with “linux /boot/vmlinuz-2.6…….”
Scroll to the end of that line and press space key once and type
init=/bin/bash
Press Crtl x to boot
$ remount / as rw
$ mount -rw -o remount /
Change password with
$ passwd
type your new password, hit enter and reboot.
== Method 2 ==
Boot from another installation of Debian. (One can use a LiveCD to get access to the “/” partition.)
Then, mount the partition where you have Squeeze’s “/”, then changed directory to /mnt/etc
Used vim as an editor to edit the file shadow.
It found the line starting with root:
Deleted everything between the first and second colons, and voila’,
root::$6$fsdsdgdsg74.:14862:0:99999:7:::
Reboot as root without a password.
At the end use passwd to set a new root password.
-
Recent
- Set Time Zone + Fedora 18
- Fedora 17 + Tata Photon (Huawei)
- Fedora 17: Install OpenSSH Server
- Change the default keyring password
- Error: Could not stat() command file ‘/usr/local/nagios/var/rw/nagios.cmd’!
- Gnone 3.X adding personal launcher
- Gnome 3.x Change Panel
- KDE remove autostart programs
- GPS on Linux
- Debian Squeeze change root password
- Download YouTube Videos on Linux
- Pidgin + The certificate for omega.contacts.msn.com could not be validated
-
Links
-
Archives
- April 2013 (1)
- September 2012 (2)
- August 2012 (2)
- July 2012 (2)
- November 2011 (1)
- July 2011 (1)
- April 2011 (1)
- January 2011 (1)
- November 2010 (1)
- September 2010 (2)
- July 2010 (3)
- March 2010 (1)
-
Categories
-
RSS
Entries RSS
Comments RSS