Check if reboot required after installing updates.

September 9, 2014 at 11:19 am (linux, TechTips) ()

After you apply updates to your Fedora system using the shell, you can quickly and easily query your system to determine if it needs a reboot or not for the updates to fully take effect.

First, make sure that you have the RPM package: yum-utils    installed.

This package includes the Python script:

/usr/bin/needs-restarting

You must run this script either as root or using sudo.  The output of the script will be a list of all the running applications that were updated after they were started.  This output will help you decide if a reboot is desired now or later.  If you are running this on your personal computer and there is any output, simply reboot now to make sure the updates have been applied.

Permalink Leave a Comment

Can’t mount a Windows 2008 share?

September 27, 2011 at 10:34 am (linux, TechTips, windows)

If you are trying to mount a Windows 2008 (or potentially other versions of windows) share using mount.cifs and you keep getting an input/output error like the one below, then read on.

[jason@superfreak ~]$ sudo mount //powerhouse-smb.mydomain.com/LogFiles /mnt/ecomm/ -tcifs -orw,username=doctor
Password:
mount error 5 = Input/output error
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)

The error reporting that is provided by mount.cifs is really not that good.  That input/output error could really mean anything.  Let’s use smbclient to attempt a connection to the share.  smbclient is sort of like a FTP client, but used to connect to a SMB share.  However, the real reason why we are using it is because it gives much more detailed error reporting by default.  Also, you could increase the debug level to some truly insane detail.

[jason@superfreak ~]$ smbclient //powerhouse-smb.mydomain.com/LogFiles -U doctor
Enter doctor’s password:
Domain=[POWERHOUSE] OS=[Windows Server 2008 R2 Standard 7601 Service Pack 1] Server=[Windows Server 2008 R2 Standard 6.1]
tree connect failed: NT_STATUS_DUPLICATE_NAME

Finally, some more detail.  The error message ‘NT_STATUS_DUPLICATE_NAME’ indicates that the connection was denied by the windows server because the destination host name that I provided was different then the computer name set on the actual destination server.  This is a security feature in Windows Server 2008 (and likely other versions of Windows).  In my case this is because I access the server through a load balancer.  There is a special virtual service on the load balancer to allow the SMB connection into the server.  However, for you the mismatch might be caused by a alias in your hosts file, bad DNS entry or simply even a mistype.

Now try the mount operation using the IP addresses instead of the hostname.  Using just the IP address will not cause that security check to trip.  Now it should work with no issues.

Happy Hacking.

Permalink Leave a Comment

IRC channel for RHEV chat and un-official support

May 28, 2010 at 11:35 am (linux, TechTips, Uncategorized) (, )

Do you work with Red Hat Enterprise Virtualization or interested in it?

Why not head on over to the unofficial IRC channel for all things RHEV?

There’s a great group of people hanging out there that can try to offer assistance and great insights.

We can be found at: chat.freenode.net  #rhev

Hope to see you there!

NOTE: This IRC channel is in no way officially related to Red Hat, Inc.

Permalink 2 Comments

Help iSCSI initiator commands for linux.

May 27, 2010 at 1:53 pm (linux, TechTips, Uncategorized) ()

I’ve been doing a lot of work lately with Red Hat Enterprise Virtualization.  The hosts that I am using are currently connecting to the SAN using iSCSI.  However, in the future they will be connecting with Fiber Channel instead.

I find myself having to remember how to use the iSCSI initiator a lot.  Here are some quick notes on how to do the most common tasks.

Discover available targets from a discovery portal

iscsiadm -m discovery -t sendtargets -p ipaddress

Log into a specific target

iscsiadm -m node -T targetname -p ipaddress -l

Log out of a specific target

iscsiadm -m node -T targetname -p ipaddress -u

Display information about a target

iscsiadm -m node -T targetname -p ipaddress

Display statistics about a target

iscsiadm -m node -s -T targetname -p ipaddress

Remove the portal address to receive information or statistics about all targets.

Display list of all current sessions logged in

iscsiadm -m session

View iSCSI database regarding discovery

iscsiadm -m discovery -o show

View iSCSI database regarding targets to log into

iscsiadm -m node -o show

View iSCSI database regarding sessions logged into

iscsiadm -m session -o show

View if the targets are multipathed (MPIO)

multipath -ll

If it is multipathed, you will see output like below (this is an example of two LUNs, both multipathed).  Note that this show the MPIO mode is round-robin:

36000d77100000b117de986015d5d5746 dm-7 FALCON,IPSTOR DISK
[size=20G][features=0][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
 \_ 12:0:0:0 sdb 8:16  [active][ready]
 \_ 13:0:0:0 sdd 8:48  [active][ready]
36000d771000002767de9860330139e10 dm-8 FALCON,IPSTOR DISK
[size=200G][features=0][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
 \_ 12:0:0:1 sdc 8:32  [active][ready]
 \_ 13:0:0:1 sde 8:64  [active][ready]

Here is a very helpful article that covers similar commands, etc.
http://kbase.redhat.com/faq/docs/DOC-6388

Permalink 3 Comments

Useful OpenSSL commands.

March 8, 2010 at 11:44 am (linux, Technology, TechTips) (, )

Often times I’ll find myself needing to do tasks with SSL certificates using OpenSSL.  I always need to look up the commands again and this takes time.  I became determined to not allow that to happen again.  This time I decided to write this quick cheat sheet of OpenSSL commands that I use often enough.  If you happen to see a command that I use here that you know of a better way to do it, please post a comment with that information for me.

Generate a private RSA key:

openssl genrsa -out host.key 1024

Generate CSR:

openssl req -new -nodes -key host.key -out host.csr
Note:  Make sure that the CN (Common Name) is the FQDN of the site that this certificate is for.

Self Signed Certificate:

openssl x509 -req -days 30 -in host.csr -signkey host.key -out host.cert

View Certificate:

openssl x509 -in filename.cert -noout -text

Permalink Leave a Comment

Squid + HAVP + HTML 5 Video tag

July 1, 2009 at 11:12 am (linux, Technology) (, , , )

Ok, so Fire Fox 3.5 came out yesterday and it now fully supports embedded video objects via the HTML 5 video tag.

Excitedly, I went to test the functionality of this new feature.  However, when testing again this URL: http://www.mozilla.com/en-US/firefox/video/ I found that the browser began to load the video but it appeared to just hang.   Now, I am using this browser on a network that sends all http traffic through a proxy server which runs Squid, HAVP and SquidGuard.

After further investigation I determined that there was a default setting in the HAVP configuration file (/usr/local/etc/havp/havp.config) that was causing this issue.

Look for this section in the config file:

# Allowing Range is a security risk, because partial
# HTTP requests may not be properly scanned.
#
# Whitelisted sites are allowed to use Range in any case.
#
# Default:
# RANGE false

Change RANGE to:

RANGE true

Remember to restart your HAVP processes.

Now, the browser will be able to play videos since it needs to request files via ranges.

Let me know if this helped you out.

Permalink 1 Comment

Fedora 10 Cheat Sheet

February 23, 2009 at 10:05 pm (linux) (, )

I wanted to just drop a quick link to a nifty Fedora 10 Cheat Sheet that I found.

http://digitizor.wordpress.com/2009/01/22/fedora-10-reference-cheatsheet/

Enjoy…

Permalink 1 Comment

Turn on line numbering in VIM.

January 21, 2009 at 3:42 pm (linux, TechTips) ()

Here’s a quick tip for how to turn on line numbering in VIM.

To turn it on:
set number
-or-
set nu

To turn it off:
set nonumber

Remember, you can always add this to your ~/.vimrc for this setting to always be on by default when ever you open VIM.

Permalink Leave a Comment

Received fax report for Hylafax using GAWK.

January 21, 2009 at 3:17 pm (coding, linux, TechTips) (, , , )

I like using the open source fax server software Hylafax for deploying fax services to a network.

One of the great things about using Hylafax for fax services, is the great flexibility you get.  Lately, one of my users requested that I create a report that could be automatically sent to her group daily.  This report was to show all faxes that were sent to their inbound fax number during the previous day.  In particular they wanted to be able to look for any faxes that someone had tried to send to them that failed for some reason.

I decied to use GAWK in order to parse the transfer log and create the resulting report.  Then, I wrapped this gawk script in a little bash script to add a little functionality.  Finally, this bash script was added to cron.daily, so as to produce the report and email it on a daily basis.

Simply change YOURFAXNUMBERHERE to be what receiving fax number you want to report on.  Finally you’ll want to pipe the output to mail if you want it to get emailed automatically.  I’m sure there are numerous better ways to make the format better, etc.  However, this is my quick script and it works perfectly for my needs.  Let me know if you find it useful.

#!/bin/bash

#####################################
# faxrecreport.sh
#
# Written by: Jason Fenner
#
# V 1.0
#
# 01/21/2009
#
# This report will print out all
# recv’d faxes for a certain inbound
# fax number that was received
# in the last 24 hour period.
#
####################################

DATEPERIOD=`date –date=yesterday +%D`
FAXNUMBER=”YOURFAXNUMBERHERE”

echo “Fax Receive Report”
echo
echo “——————“
echo “Fax Number: $FAXNUMBER”
echo “24 Hour Period for: $DATEPERIOD”
echo “——————“
echo
echo

awk -F’\t’ ‘BEGIN{ “date –date=yesterday +%D ” | \
getline dateVal; printf(“%15s%30s%15s%7s %8s%50s %12s\n”,”Date”,”Name”,”CallerID”,”Pages”,”Duration”,”Error”,”Ref”); \
for (x=1; x<=140; ++x) {printf( “%s” , “-” ) } \
print “” }
($2 ~ /RECV/ && $16 ~ /YOURFAXNUMBERHERE/ && $1 ~ dateVal) \
{gsub(/\”/,””); if ($14 == “”) $14 = “None”; \
if ($15 == “”) $15 = “Not Received”; \
printf(“%15s%30s%15s%7s %8s%50s %12s\n”, $1,$9,$15,$11,$13,$14,$3)
}

END{ for (x=1; x<=140; ++x) {printf( “%s” , “-” ) } \
print “” }’ /var/spool/hylafax/etc/xferfaxlog

Permalink 3 Comments

Random Password Generator

October 27, 2008 at 2:34 pm (linux) ()

In my line of work, I often need to generate random passwords for new accounts.  I always find it kind of annoying to have to think these things up.  Every now and then I even need to created many at once.

Here is a quick way to generate as many random passwords as you want just using BASH:


for ((i=0; i<10; i=i+1)); do head -c 8 /dev/urandom | uuencode -m - | head -n 2 | tail -n 1 | sed s/\=//; done

Simply adjust the ‘i’ variable in the for loop to change how many passwords you want.  The ‘-c’ on the first head statment can be changed to adjust the size of each password that is created.  The real nice thing about this little snipet, is that it outputs to stdout…this makes it a cinch to send to output on to something else.

For an added twist, you can use this line to have the generated passwords contain more punctuation marks:

for ((i=0; i<10; i=i+1)); do head -c 8 /dev/urandom | uuencode - | head -n 2 | tail -n 1 | sed s/\`// | sed s/\(//; done

With this one, make sure you filter out any special characters that aren’t allowed in your new passwords.

Enjoy.

Permalink Leave a Comment

Next page »

Follow

Get every new post delivered to your Inbox.