What if this is seen:
# keytool -list
keytool error: java.lang.Exception: Keystore file does not exist: /root/.keystore
#
Then this can be done to resolve it, specify the actual keystore location to use:
keytool –list -keystore /path/to/some/trust.keystore
Cheers,
TK
November 9th, 2014 | Posted in NIX Posts | No Comments
Part of our earlier two posts on Remote Desktop Connection: SSH Tunnel through Putty and DD-WRT for RDP / RDC and Enabling RDP on Windows 7 Home Premium Edition where we setup our RDP connections, we came across an issue of automatic disconnects in our RDP sessions. Tricky to debug, here are the steps we took to solve this problem.
Read the rest of this entry »
November 8th, 2014 | Posted in NIX Posts | No Comments
Life in Linux would be far more difficult without grep. So what's the equivalent in Windows?
C:\Users\tom>netstat -na|findstr 3389
TCP 0.0.0.0:3389 0.0.0.0:0 LISTENING
TCP [::]:3389 [::]:0 LISTENING
C:\Users\tom>
Very neat! But now how to alias this guy. Well, we can do this but it doesn't quite work in pipes:
C:\Users\tom>doskey grep=c:\windows\system32\findstr.exe $*
C:\Users\tom>doskey /macros
grep=c:\windows\system32\findstr.exe $*
C:\Users\tom>grep
FINDSTR: Bad command line
C:\Users\tom>
Have fun with that.
Cheers,
Tom
November 8th, 2014 | Posted in NIX Posts | No Comments
Earlier we've setup our HTPC and Backup and shared it out to our Windows machines, but one thing we did not add in is the backup job. With the earlier solutions, the backup becomes trivial. (Anything can become simple as long as the core design is well designed with future simplicity in mind.) This is fairly simple by most system administrator standards but does assume you do know a bit of scripting to do the job with. Naturally this can be done even easier so I'll show two options. First the KSH option for automating this slightly:
#!/usr/bin/ksh
MOI=$(basename $0);
CDATE=$(date);
print — "$MOI: ($CDATE): Starting run of $MOI. " >> /var/log/$MOI.log 2>&1;
# TM="YES";
TM="NO";
TARGET="/mnt/HTPCBackupXFS";
for KEY in $( print \
/mnt/FLASHLexarMedia-32GB-1 \
/mnt/FLASHLexarMedia-32GB-0 \
/mnt/FLASHKingstonCenton \
/mnt/VGEnt \
/mnt/HTPCFileStorage \
); do
[[ $TM == “NO” ]] && {
print — "$MOI: Running rsync -avc –progress $KEY $TARGET:";
rsync -avc –progress $KEY $TARGET;
} || {
print — "$MOI: Will run rsync -avc –progress $KEY $TARGET .";
}
done >> /var/log/$MOI.log 2>&1;
Next we will edit the crontab to add in the job (Type crontab -e on the command line to edit the crontab file):
[root@mbpc-pc mnt]# crontab -l
30 0 * * * nice -n 19 /mnt/htpc.ksh
[root@mbpc-pc mnt]#
This will backup the other drives that I'm sharing to the RAID6 storage we've created. Next we will take the key bits from there to create separate cron jobs in case scripting or KSH is not your thing. This is just as good and may be quicker as it'll be ran in parallel (again type crontab -e to get in and edit the crontab file):
30 0 * * * nice -n 19 rsync -avc –progress /mnt/FLASHLexarMedia-32GB-1 /mnt/HTPCBackupXFS;
30 0 * * * nice -n 19 rsync -avc –progress /mnt/FLASHLexarMedia-32GB-0 /mnt/HTPCBackupXFS;
30 0 * * * nice -n 19 rsync -avc –progress /mnt/FLASHKingstonCenton /mnt/HTPCBackupXFS;
30 0 * * * nice -n 19 rsync -avc –progress /mnt/VGEnt /mnt/HTPCBackupXFS;
30 0 * * * nice -n 19 rsync -avc –progress /mnt/HTPCFileStorage /mnt/HTPCBackupXFS;
Naturally, both methods work just as well and you may benefit from some parallelism here doing it the above way. However, as more sources are managed, this may become more difficult to manage and more editing will be needed. The above job schedules the backups to start 30 minutes past midnight, 0 and runs every day, *, every month, * each year, *, respectively from left to right.
Cheers,
TK
October 13th, 2014 | Posted in NIX Posts | No Comments
[root@mbpc-pc mnt]# at now htpc.ksh
syntax error. Last token seen: h
Garbled time
[root@mbpc-pc mnt]# at now
at> /mnt/htpc.ksh
at>
job 12 at 2014-10-12 14:04
[root@mbpc-pc mnt]#
[root@mbpc-pc mnt]# ps -ef|grep -i htpc.ksh
root 26031 26030 0 14:04 ? 00:00:00 /usr/bin/ksh /mnt/htpc.ksh
root 26042 24646 0 14:04 pts/2 00:00:00 grep -i htpc.ksh
[root@mbpc-pc mnt]#
For reoccurring see cron.
Cheers,
TK
October 12th, 2014 | Posted in NIX Posts | No Comments
Trying to change the sharing through selinux results in this:
[root@mbpc-pc mnt]# chcon -R -t samba_share_t /mnt/FLASHLexarMedia-32GB-1
chcon: failed to change context of `/mnt/FLASHLexarMedia-32GB-1' to `system_u:object_r:samba_share_t:s0': Operation not supported
[root@mbpc-pc mnt]#
[root@mbpc-pc mnt]# ls -lda –author -Z FLASHLexarMedia-32GB-1
drwx——. root root system_u:object_r:dosfs_t:s0 FLASHLexarMedia-32GB-1
[root@mbpc-pc mnt]#
[root@mbpc-pc mnt]# ls -lda –author -Z FLASHKingstonCenton
drwxrwxrwx. root root system_u:object_r:fusefs_t:s0 FLASHKingstonCenton
[root@mbpc-pc mnt]#
The issue is that you need to put the context line in the /etc/fstab mount command for NFS / VFAT like this:
[root@mbpc-pc mnt]# grep /mnt/FLASHKingstonCenton /etc/fstab
/dev/sdj1 /mnt/FLASHKingstonCenton ntfs context=system_u:object_r:samba_share_t:s0 0 2
[root@mbpc-pc mnt]#
[root@mbpc-pc mnt]# ls -lda –author -Z FLASHKingstonCenton
drwxrwxrwx. root root system_u:object_r:samba_share_t:s0 FLASHKingstonCenton
[root@mbpc-pc mnt]#
This should allow you to write/read to this volume from your windows network mounts.
Cheers,
TK
July 6th, 2014 | Posted in NIX Posts | 1 Comment
Here is a quick way to keep the last 5000 lines of a large file instead of entirely clearing it. A little bit of AWK though a simple array and bob's your uncle:
root [XYZ01] /var/spool/mail: ls -altri test.txt daemon
1067 -rw-rw—- 1 daemon mail 51130586 Jan 31 07:30 daemon
1061 -rw-rw—- 1 daemon mail 186022 Feb 1 00:20 test.txt
root [XYZ01] /var/spool/mail: cp -ip daemon test.txt
overwrite test.txt? y
root [XYZ01] /var/spool/mail: ls -altri test.txt daemon
1061 -rw-rw—- 1 daemon mail 51130586 Jan 31 07:30 test.txt
1067 -rw-rw—- 1 daemon mail 51130586 Jan 31 07:30 daemon
root [XYZ01] /var/spool/mail: FILEN="test.txt"; tail -n 5000 $FILEN|awk 'BEGIN { FILEN="'"$FILEN"'"; } { ARY[CNT++]=””$0; } END { for ( KEY in ARY ) { print ARY[KEY] > FILEN; } }'
root [XYZ01] /var/spool/mail: ls -altri test.txt daemon
1067 -rw-rw—- 1 daemon mail 51130586 Jan 31 07:30 daemon
1061 -rw-rw—- 1 daemon mail 186022 Feb 1 00:21 test.txt
root [XYZ01] /var/spool/mail: wc -l test.txt
5000 test.txt
root [XYZ01] /var/spool/mail:
root [XYZ01] /var/spool/mail:
Cheers,
Tom
February 1st, 2014 | Posted in NIX Posts | No Comments
Here's a nifty way of figuring out if you have IP conflicts on a network ( yum search arp-scan ) :
[root@mbpc-pc ~]# arp-scan -I bond0 -l
Interface: bond0, datalink type: EN10MB (Ethernet)
Starting arp-scan 1.9 with 512 hosts (http://www.nta-monitor.com/tools/arp-scan/)
192.168.0.1 f8:11:11:bc:47:8a TP-LINK TECHNOLOGIES CO., LTD.
192.168.0.2 54:e6:fc:fb:ad:06 TP-LINK TECHNOLOGIES CO., LTD.
192.168.0.11 90:e6:b4:c6:7d:35 ASUSTek COMPUTER INC.
192.168.0.12 00:21:dc:cc:64:f4 Flextronics International
192.168.0.13 94:de:80:73:b1:78 GIGA-BYTE TECHNOLOGY CO.,LTD.
192.168.0.15 14:da:19:19:95:b5 ASUSTek COMPUTER INC.
192.168.0.10 28:5d:60:ca:44:1c Azurewave Technologies, Inc.
8 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.9: 512 hosts scanned in 3.460 seconds (147.98 hosts/sec). 7 responded
[root@mbpc-pc ~]#
Cheers,
Tom
January 3rd, 2014 | Posted in NIX Posts | No Comments
Here are a few ways of recovering off screen windows by resizing and moving them. This is particularly handy for folks that use multiple monitors then switch locations that have different configurations. This table summarizes the options:
|
#
|
Method
|
|
Keyboard
|
ALT + TAB to Application
Then:
ALT + SPACE then M ( SHIFT + M ) then either use the arrow keys or move the mouse as it will ove the window since it will be attached to the application window at this point.
|
|
Mouse
|
Right click on the app icon on the taskbar then click Move. Your mouse should now be attached to the window. Just move the mouse around to get your window back. You can also use the arrow keys at this point to move the window as well.
|
|
Maximize option
|
Right click on the app ion on the taskbar then click Maximize. This should maximize in the current window. Then left click and hold on the title bar to drag.
|
|
Windows Key
|
Click the icon in the taskbar then hold down the Windows key and use the arrow keys to move the window back into view.
|
Cheers,
TK
October 24th, 2013 | Posted in Windows | No Comments
We've baught outselves four Intec PS3 controllers from The Source for about $3 each. Yep, you read that right. Just $3. Pulled up some old classic shooters that we haven't tried for some time but without a controller, they won't work. Most controllers today, even the cheapest ones, are far better then the old ones from the Gravis Gamepad days. The equivalent PS3 or PC Controllers are typically around $20 but in this case the deal was too good. The question or not was whether this is going to work with a regular PC / Computer / Laptop. It turns out that it can.
Read the rest of this entry »
August 31st, 2013 | Posted in NIX Posts | No Comments