MoonPoint Support Logo

 


Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
June
Sun Mon Tue Wed Thu Fri Sat
 
       
2015
Months
Jun


Tue, Jun 30, 2015 10:09 pm

Transferring files with scp through a bastion host on an OS X system

I need to transfer files through a bastion host periodically. To edit files on a webserver, I need to first establish a Secure Shell (SSH) connection to the bastion host, logging in using an RSA SecurID token. Once I've provided my login credentials, the bastion host prompts me for the system to which I want to connect to from it, which in this case is the web server. So my ssh login to the webserver is tunneled through the bastion host.

I normally go through the process once a month from my MacBook Pro laptop running the OS X operating system when I need to place a monthly newsletter on the web server. I use an SSH command similar to the following to log into the bastion host where gold.example.com is the fully qualified domain name (FQDN) of the web server and bastion1.example.com is the bastion host.

ssh -L 22001:gold.example.com:22 jasmith1@bastion1.example.com

The -L option specifies I want to tunnel a local port on my laptop, in this case I chose 22001, to port 22 on the web server, gold.example.com. A tunnel is set up from my laptop to the web server through the bastion host by using that option once my login is completed to the bastion host.

Then, to transfer a file via secure copy from my laptop to the web server, I can use a command like the following one to transfer a file named July.txt from the laptop to the web server:

$ scp -P 22001 July.txt jasmith1@127.0.0.1:/data/htdocs/clubs/groot/newsletter/2015/.
jasmith1@127.0.0.1's password:

The -P option to the scp command specifies I want to use TCP port 22001, since that is the port for the end of the tunnel on my laptop. The 127.0.0.1 address I'm specifying is the localhost, aka "loopback", address on my laptop. I.e., I'm connecting to port 22001 on the laptop itself. The tunnel I set up earlier results in any connection to that port being forwared through the tunnel to the web server, so I'm specifying my userid for the web server and the password prompt I receive is for the web server. The file July.txt will thus be placed in the directory /data/htdocs/clubs/groot/newsletter/2015 on the web server with the same name, July.txt.

If I wanted to pull a file from the webserver via the tunnel, I could use a command such as the following:

scp -P 22001 jasmith1@127.0.0.1:/data/htdocs/clubs/groot/July.html .

That command would retrieve the file July.html from the web server and place it on the laptop with the same name.

[/network/ssh] permanent link

Mon, Jun 29, 2015 10:35 pm

Seting up an FTP server on a CentOS 7 system

The vsftpd package can be used on a CentOS 7 system to provide FTP server service from the system. After installing the package, you may want to customize its configuration for your needs. After configuring it, you will need to start the service with systemctl start vsftpd and will need to issue the systemctl enable vsftpd command to ensure it starts automatically when the system boots. You will also need to allow FTP connectivity in to the system from FTP clients by configuring the firewall software on the CentOS 7 systems as well, which by default is firewalld for CentOS 7 systems.

[ More Info ]

[/os/unix/linux/centos] permanent link

Sun, Jun 28, 2015 9:08 pm

Viewing Policies and Configuring a Policy for FTP

You can check the current policies in a Juniper NetScreen firewall running the ScreenOS operating system, such as a Netscreen-5GT firewall, with get policy all, but you can also display just those policies affecting transmissions from one particular zone to another zone by adding a from from_zone to to_zone to the end of the command. E.g. get policy from untrust to trust would show only those policies that apply to traffic from the untrust zone to the trust zone.

To view only those policies that apply to a particular service, such as FTP, I could use get policy from untrust to trust | include FTP.

ns5gt-> get policy from untrust to trust | include FTP
    24 Untrust  Trust    ACME VPN     VIP(untrust) FTP                  Permit enabled ---X-X
    25 Untrust  Trust    ACI          VIP(untrust) FTP                  Permit enabled ---X-X
ns5gt->

Steps are listed here that can be used to create a policy that will allow FTP connectivity from external systems to an internal FTP server behind the firewall.

[/security/firewalls/netscreen] permanent link

Sat, Jun 27, 2015 8:13 pm

You don't have permission to access /phpmyadmin on this server

When I tried to access phpMyAdmin on a CentOS 7 system running Apache web server software, I saw the message below:

Forbidden

You don't have permission to access /phpmyadmin on this server.

I looked for phpmyadmin.conf, but couldn't find it on the system, but then realized that I needed to use an uppercase "M" and "A"

# locate phpmyadmin.conf
# locate phpMyAdmin.conf
/etc/httpd/conf.d/phpMyAdmin.conf

I thought I had allowed access from all internal systems on the same LAN to phpMyAdmin on the webserver by modifying phpMyAdmin.conf to allow access from the subnet on which the internal systems resided. I checked the configuration file again and it appeared I had allowed access there.

<Directory /usr/share/phpMyAdmin/>
   AddDefaultCharset UTF-8

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       Require ip 127.0.0.1 192.168.0
       Require ip ::1
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1 192.168.0
     Allow from ::1
   </IfModule>
</Directory>

Since the internal systems were on a 192.168.0.0/24 subnet, I had added 192.168.0 previously to the Require IP and Allow from lines, so that access was allowed both from the localhost address, 127.0.0.1, i.e., from the system itself, and from other systems on the LAN. I knew I had done that quite some time ago and that the Apache webserver had been restarted a number of times subsequent to that change.

I checked the IP address the server was seeing for the system from which I had tried accessing it using http://www.example.com/phpMyAdmin and realized it was seeing the external IP address of the firewall behind which the webserver resides, because I had used the fully qualified domain name (FQDN) for the server, i.e., www.example.com, which caused the connectivity from the internal system to the web server to go out through the firewall and back in. When I used the internal IP address for the webserver on which phpMyAdmin resided with http://192.168.0.22/phpMyAdmin, I was able to access the phpMyAdmin interface from an internal system on the LAN on which it resides.

References:

  1. Installing phpMyAdmin on a CentOS System Running Apache
    Date: August 8, 2010
    MoonPoint Support

[/network/web/tools/phpmyadmin] permanent link

Fri, Jun 26, 2015 11:21 pm

Monitoring performance on an OS X system

If you wish to monitor the performance of an OS X system, Apple provides a number of utilities with the operating system to allow you to monitor CPU, memory, and network utilization as well as other system parameters. The Activity Monitor found in Applications/Utilities provides a graphical user interface (GUI) for monitoring CPU, memory, and, to a limited extent, network utilization. The top command found on Linux systems is also present and provides a command line tool for monitoring memory and CPU utilization. For network monitoring, there is also the Network Utility in Applications/Utilities.

[/os/os-x] permanent link

Thu, Jun 25, 2015 10:46 pm

Defining a name for a cell in Google Sheets

If you are using Google Sheets, which is a free online spreadsheet service that is part of Google Docs, for spreadsheets and need to define a name for a cell as one can do in Microsoft Excel, select the cell for which you wish to create a name so that you can reference the cell by that name rather than its specific location, such as Sales!B3 to reference the cell in column B row 3 on the Sales worksheet, take the following steps, assuming you wished the name to be Bobs_Sales:
  1. Select Data from the menu bar at the top of the spreadsheet window.
  2. Select Named ranges.
  3. Click on Add a range.

    Named ranges - add a range

  4. Fill in the name you wish to use to refer to the cell and below it the location, which can include the sheet name, if you have multiple worksheets in the spreadsheet, followed by an exclamation mark, i.e., !, and then the cell location, i.e., columan and row, e.g., Sales!B3.

    Named ranges - name defined

  5. Click on Done to add the name and close the Named ranges window by clicking on the "X" in the upper, right-hand corner.

You could then put =Bobs_Sales in a cell in the same sheet or another sheet in the workbook to have the value stored in Sales!B3 appear in the location where you've placed =Bobs_Sales. That allows you to use a name that is easy for you to remember rather than having to remember or look up the specific location for the data.

[/network/web/services/google] permanent link

Sun, Jun 21, 2015 5:05 pm

Formatting the output from the date command on a Linux system

I wanted to put a time stamp in a log file whenever a script on a Linux system is run. If you just enter date with no parameters at a shell prompt, you will see something like the following:

$ date
Sun Jun 21 16:10:49 EDT 2015

But you can modify how the output from the date command is presented by specifying command line parameters for the command using date +format, where format is how you wish the output formatted. Parameters that can be used to format the display are listed below:

Format StringDescription
%%a literal %
%alocale's abbreviated weekday name (e.g., Sun)
%Alocale's full weekday name (e.g., Sunday)
%blocale's abbreviated month name (e.g., Jan)
%Blocale's full month name (e.g., January)
%clocale's date and time (e.g., Thu Mar 3 23:05:25 2005)
%Ccentury; like %Y, except omit last two digits (e.g., 21)
%dday of month (e.g, 01)
%Ddate; same as %m/%d/%y
%eday of month, space padded; same as %_d
%Ffull date; same as %Y-%m-%d
%glast two digits of year of ISO week number (see %G)
%Gyear of ISO week number (see %V); normally useful only with %V
%hsame as %b
%Hhour (00..23)
%Ihour (01..12)
%jday of year (001..366)
%khour ( 0..23)
%lhour ( 1..12)
%mmonth (01..12)
%Mminute (00..59)
%na newline
%Nnanoseconds (000000000..999999999)
%plocale's equivalent of either AM or PM; blank if not known
%Plike %p, but lower case
%rlocale's 12-hour clock time (e.g., 11:11:04 PM)
%R24-hour hour and minute; same as %H:%M
%sseconds since 1970-01-01 00:00:00 UTC
%Ssecond (00..60)
%ta tab
%Ttime; same as %H:%M:%S
%uday of week (1..7); 1 is Monday
%Uweek number of year, with Sunday as first day of week (00..53)
%VISO week number, with Monday as first day of week (01..53)
%wday of week (0..6); 0 is Sunday
%Wweek number of year, with Monday as first day of week (00..53)
%xlocale's date representation (e.g., 12/31/99)
%Xlocale's time representation (e.g., 23:13:48)
%ylast two digits of year (00..99)
%Yyear
%z+hhmm numeric timezone (e.g., -0400)
%:z+hh:mm numeric timezone (e.g., -04:00)
%::z+hh:mm:ss numeric time zone (e.g., -04:00:00)
%:::znumeric time zone with : to necessary precision (e.g., -04 , +05:30)
%Zalphabetic time zone abbreviation (e.g., EDT)

Table from HowTo Format Date For Display or Use In a Shell Script by Vivek Gite on February 27, 2007

E.g., if I wanted to display the date in the form of year-month-day, I could use the following:

$ date +"%y-%m-%d"
15-06-21

If you use a lowercase "y", then the year will be displayed as a two-digit year, i.e. "15" in this case for 2015, but if I wanted to have the year displayed as a four-digit year, I could use an uppercase "Y" as shown below:

$ date +"%Y-%m-%d"
2015-06-21

In this case I also wanted to log the time in 24-hour format, aka "military time", on the same line as the date, so I could append a %T.

$ date +"%Y-%m-%d %T"
2015-06-21 16:31:40

If I wanted to store the results of the command in a variable, I could use the following:

$ NOW=$(date +"%Y-%m-%d %T")
$ echo $NOW
2015-06-21 16:48:15

[/os/unix/commands] permanent link

Fri, Jun 19, 2015 10:23 pm

Markup Data Folder does not exist

If you see a "Markup Data Folder does not exist!" error message while you are using the CoffeeCup HTML Editor, which is a program used to edit pages for a website, which references a directory, such as "C:\Users\Public\Documents\CoffeeCup Software\HTML Editor\Markup\HTML4.01\." it may be because you installed CoffeeCup HTML Editor using a different account than the one you are now using.
O'Reilly - Get Started Today

Markup Data Folder does not exist

I encountered that error after installing the software for a family member. I had installed the software under an administrator account, but when I was later testing the software under her account I saw that error message appear frequently. You can remedy the problem by copying fhe folder from the account under which it was installed to another account where you wish to use the software.

You can do that In Windows 8 while logged into a non-privileged account, i.e., one that isn't in the administrator group, by right-clicking on the Start button, then choosing Command Prompt (Admin) and providing a userid and password for an account that is in the administrator group. E.g., in this case I provided the credentials for the account under which I installed the software, since it was an account in the administrator group.

You can find the Markup directory beneath C:\Users\userid\AppData\Roaming\CoffeeCup Software\CoffeeCup HTML Editor\Markup where userid is the user name for the account under which you installed the CoffeCup HTML Editor. E.g., supposing the userid was JDoe, I would see the following:

 Volume in drive C has no label.
 Volume Serial Number is 5C60-1B61

 Directory of C:\Users\JDoe\AppData\Roaming\CoffeeCup Software\CoffeeCup HTML Editor\Markup

06/12/2015  12:51 PM    <DIR>          .
06/12/2015  12:51 PM    <DIR>          ..
06/12/2015  12:51 PM    <DIR>          CSS2.1
06/12/2015  12:51 PM    <DIR>          CSS3
06/24/2010  11:44 AM             3,055 doctypes.txt
06/12/2015  12:51 PM    <DIR>          Entities
06/12/2015  12:51 PM    <DIR>          HTML
03/12/2014  09:45 AM            22,830 html-entities.conf
06/12/2015  12:51 PM    <DIR>          HTML4.01
06/12/2015  12:51 PM    <DIR>          HTML5
06/12/2015  12:51 PM    <DIR>          Markdown
03/06/2014  09:43 AM            70,692 opengraph.dat
12/16/2013  08:22 AM           944,004 schema.dat
06/12/2015  12:51 PM    <DIR>          XHTML1
06/28/2010  02:17 PM                93 _default.css
               5 File(s)      1,040,674 bytes
              10 Dir(s)  3,738,071,187,456 bytes free

From an admin command prompt, I could then copy the contents to a similar location under another account where I want to be able to use the software. E.g., supposing I wanted to copy from the JDoe account to a Jane account, I could use the xcopy command below.

xcopy /s "C:\Users\JDoe\AppData\Roaming\CoffeeCup Software\CoffeeCup HTML Editor" "C:\Users\Jane\AppData\Roaming\CoffeeCup Software\CoffeeCup HTML Editor\."

There are over 800 files in the folder and its subfolders. Once they are copied, if you had the HTML Editor open during that process, close and reopen it.

I also encountered a problem while configuring the HTML Editor to display files in browsers on the system, which gives you the opportunity to see what a page will look like in multiple browsers. That problem was also related to directory permissions, since the CoffeeCup HTML Editor was attempting to create files in a directory where only accounts in the administrator group should be able to create files - see Configuring CoffeCup HTML Editor for browser support.

References:

  1. "Markup Data Folder Does Not Exist" Error
    By: Scott Swedorski
    Date: June 6, 2013
    HTML Editor, Website & Web Design Software | CoffeeCup Software

[/os/windows/software/coffeecup] permanent link

Thu, Jun 18, 2015 11:19 pm

Viewing information on wireless networks from shell prompt

On an Ubuntu Linux system, you can use the iwconfig command at a shell prompt, i.e., a command line interface, to view information on available networks. Iwconfig is part of the wireless-tools package.

If you are currently connected to a wireless network, you will see something similar to the following, if you run the command with no arguments specified. In the example below, the system is connected to a wifi network that has a service set identification (SSID) of T28J5 at a bit rate of 1 Mbs.

$ iwconfig
lo        no wireless extensions.

wlan0     IEEE 802.11bgn  ESSID:"T28J5"  
          Mode:Managed  Frequency:2.412 GHz  Access Point: 00:1F:90:B2:9F:A4   
          Bit Rate=1 Mb/s   Tx-Power=14 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=70/70  Signal level=-33 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:65   Missed beacon:0

eth0      no wireless extensions.

You can specify a wireless interface to avoid the display of extraneous information for interfaces that are not wireless interfaces, e.g., iwconfig wlan0.

I can see from the above output that the wireless interface supports the 802.11 b, g, and n standards.

The arguments for the command can be seen by issuing the command iwconfig --help at a shell prompt.

$ iwconfig --help
Usage: iwconfig [interface]
                interface essid {NNN|any|on|off}
                interface mode {managed|ad-hoc|master|...}
                interface freq N.NNN[k|M|G]
                interface channel N
                interface bit {N[k|M|G]|auto|fixed}
                interface rate {N[k|M|G]|auto|fixed}
                interface enc {NNNN-NNNN|off}
                interface key {NNNN-NNNN|off}
                interface power {period N|timeout N|saving N|off}
                interface nickname NNN
                interface nwid {NN|on|off}
                interface ap {N|off|auto}
                interface txpower {NmW|NdBm|off|auto}
                interface sens N
                interface retry {limit N|lifetime N}
                interface rts {N|auto|fixed|off}
                interface frag {N|auto|fixed|off}
                interface modulation {11g|11a|CCK|OFDMg|...}
                interface commit 
       Check man pages for more details.

You can also use the iwlist command to display some additional information from a wireless network interface that is not displayed by iwconfig. The main argument is used to select a category of information; iwlist displays in detailed form all information related to this category, including information already shown by iwconfig.

The options, which you can view by typing iwlist --help or just iwlist at a shell prompt, for the command are shown below:

$ iwlist
Usage: iwlist [interface] scanning [essid NNN] [last]
              [interface] frequency 
              [interface] channel 
              [interface] bitrate 
              [interface] rate 
              [interface] encryption 
              [interface] keys 
              [interface] power 
              [interface] txpower 
              [interface] retry 
              [interface] ap 
              [interface] accesspoints 
              [interface] peers 
              [interface] event 
              [interface] auth 
              [interface] wpakeys 
              [interface] genie 
              [interface] modulation

If you are connected to a wireless network already, you can view information on that network by typing ifwlist scan. E.g., in the example below, the system is connected to a wireless network that has a SSID of T28J5, which can support a maximum transmission rate of 54 Mbs.

$ iwlist scan
lo        Interface doesn't support scanning.

wlan0     Scan completed :
          Cell 01 - Address: 00:1F:90:B2:9F:A4
                    Channel:1
                    Frequency:2.412 GHz (Channel 1)
                    Quality=70/70  Signal level=-36 dBm  
                    Encryption key:on
                    ESSID:"T28J5"
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 6 Mb/s; 9 Mb/s
                              11 Mb/s; 12 Mb/s; 18 Mb/s
                    Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
                    Mode:Master
                    Extra:tsf=0000000733f20181
                    Extra: Last beacon: 22940ms ago
                    IE: Unknown: 00055432384A35
                    IE: Unknown: 010882848B0C12961824
                    IE: Unknown: 030101
                    IE: Unknown: 0706555320010B1B
                    IE: Unknown: 200100
                    IE: Unknown: 2A0100
                    IE: Unknown: 32043048606C
                    IE: Unknown: DD0900037F010100200000

eth0      Interface doesn't support scanning.

If you know the designation for the wireless interface in the system, e.g. wlan0 in this case, you can avoid attempting to scan interfaces, such as eth0, which is a wired rather than wireless interface, by specifying the wireless interface when issuing the command, e.g., iwlist wlan0 scan.

$ iwlist wlan0 scan
wlan0     Scan completed :
          Cell 01 - Address: 00:1F:90:B2:9F:A4
                    Channel:1
                    Frequency:2.412 GHz (Channel 1)
                    Quality=70/70  Signal level=-33 dBm  
                    Encryption key:on
                    ESSID:"T28J5"
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 6 Mb/s; 9 Mb/s
                              11 Mb/s; 12 Mb/s; 18 Mb/s
                    Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
                    Mode:Master
                    Extra:tsf=000000075edbf181
                    Extra: Last beacon: 57620ms ago
                    IE: Unknown: 00055432384A35
                    IE: Unknown: 010882848B0C12961824
                    IE: Unknown: 030101
                    IE: Unknown: 0706555320010B1B
                    IE: Unknown: 200100
                    IE: Unknown: 2A0100
                    IE: Unknown: 32043048606C
                    IE: Unknown: DD0900037F010100200000

You can see the current bitrate with iwlist <interface> bitrate.

$ iwlist wlan0 bitrate
wlan0     unknown bit-rate information.
          Current Bit Rate=1 Mb/s

If you are already connected to a wifi network and want to disconnect you can type ifconfig interface down where interface is the designation for the relevant wireless interface, e.g., wlan0. You can see a list of all available interfaces with ifconfig -a. If you don't run the ifconfig wlan down command from the root account or use sudo on a Ubuntu system, you will receive a "permission denied" error message. You can use sudo ifconfig to run the command from an account with sudo privileges.

$ ifconfig wlan0 down
SIOCSIFFLAGS: Permission denied
$ sudo ifconfig wlan0 down
[sudo] password for jdoe:
$

But with the above method, the system may bring the interface back up automatically a few seconds later. You can use the command-line tool nmcli for controlling NetworkManager, instead. To disable the wifi interface, you can use nmcli nm wifi off.

$ nmcli nm wifi off
$

You can re-enable the wifi interface with nmcli nm wifi on. If the system has previously connected to an available wifi network and has the credentials stored to automatically connect to that network, when you issue the nmcli nm wifi on command, it will automatically reconnect to the network.

You can see the current status of the wifi interface with nmcli nm wifi. E.g., if it is enabled, you would see the following:

$ nmcli nm wifi
WIFI      
enabled

If you wish to see a list of the stored wifi networks you can use the nmcli con command, which shows information about NetworkManager's connections. For information on a particular one you can use nmcli con list id identifier, where identifier is the id for the wireless network, e.g., T28J5 or in the example below VA Internet for the guest network at a hospital.

$ nmcli con list id "VA Internet"
connection.id:                          VA Internet
connection.uuid:                        8cd16736-f340-42a8-b103-1b87d24973b9
connection.type:                        802-11-wireless
connection.autoconnect:                 yes
connection.timestamp:                   1434474233
connection.read-only:                   no
connection.permissions:                 
802-11-wireless.ssid:                   'VA Internet'
802-11-wireless.mode:                   infrastructure
802-11-wireless.band:                   not set
802-11-wireless.channel:                0
802-11-wireless.bssid:                  not set
802-11-wireless.rate:                   0
802-11-wireless.tx-power:               0
802-11-wireless.mac-address:            90:4C:E5:2F:6F:2E
802-11-wireless.cloned-mac-address:     not set
802-11-wireless.mac-address-blacklist:  
802-11-wireless.mtu:                    auto
802-11-wireless.seen-bssids:            
802-11-wireless.security:               not set
ipv4.method:                            auto
ipv4.dns:                               
ipv4.dns-search:                        
ipv4.addresses:                         
ipv4.routes:                            
ipv4.ignore-auto-routes:                no
ipv4.ignore-auto-dns:                   no
ipv4.dhcp-client-id:                    not set
ipv4.dhcp-send-hostname:                yes
ipv4.dhcp-hostname:                     not set
ipv4.never-default:                     no
ipv4.may-fail:                          yes
ipv6.method:                            auto
ipv6.dns:                               
ipv6.dns-search:                        
ipv6.addresses:                         
ipv6.routes:                            
ipv6.ignore-auto-routes:                no
ipv6.ignore-auto-dns:                   no
ipv6.never-default:                     no
ipv6.may-fail:                          yes

[/os/unix/linux/ubuntu] permanent link

Mon, Jun 15, 2015 10:23 pm

Batch file to display average ping times

If you run the ping command in windows with no parameters specified other than the system to ping, the output will look similar to the following:

C:\>ping google.com

Pinging google.com [216.58.217.142] with 32 bytes of data:
Reply from 216.58.217.142: bytes=32 time=12ms TTL=55
Reply from 216.58.217.142: bytes=32 time=16ms TTL=55
Reply from 216.58.217.142: bytes=32 time=13ms TTL=55
Reply from 216.58.217.142: bytes=32 time=13ms TTL=55

Ping statistics for 216.58.217.142:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 12ms, Maximum = 16ms, Average = 13ms

If I want to just see the ping times and no other output from the ping command, I could use a FOR /F command such as is shown below. The "pipe" character, |, used to pipe output from one command to another should be prefixed with ^, which serves as an "escape character".

C:\>for /f "tokens=7 delims== " %g in ('ping google.com ^| find "Reply from"') do @echo %g
22ms
15ms
13ms
22ms

To do the same thing from a batch file, I could put the following commands in a batch file:

@echo off

set HostToPing="google.com"

for /f "tokens=7 delims== " %%g in ('ping %HostToPing% ^| find "Reply from"') do echo %%g

The differences are that I would need to use %%g, instead of %g in the batch file and I could use echo in the batch file rather than @echo, since I put @echo as the first line of the batch file to turn off the display of the comands themselves.

By default, when you run the ping command on a Microsoft Windows system, it will issue 4 pings then stop. But you can control the number of pings sent by using the -n count parameter, where count is the number of pings to send.

    -n count       Number of echo requests to send.

If I want to monitor the average response time to pings to a given host over a long period of time, I could issue the ping command with a very large number of echo requests specified or use the -t parameter, e.g., ping -t to have the pings run indefinitely:

    -t             Ping the specified host until stopped.
                   To see statistics and continue - type Control-Break;
                   To stop - type Control-C.

I could store the results in a file by redirecting output from the command with the output redirection character >, i.e., ping -n 500000 google.com >pingoutput.txt. Or I could just look at the line where ping displays the average and create a loop where pings are run periodically. The line where the average is shown by ping looks like the following:

Minimum = 14ms, Maximum = 17ms, Average = 15ms

To just look at that average value, but also time stamp the output, so I can determine if ping times to a particular host are changing significantly over the course of a day, I could use code similar to the following in a batch file, substituting the particular host I'm interested in for google.com and using the timeout command present in Microsoft Windows 7/2008 and later versions to specify the pause period between instances of the ping command being run. The timeout command is similar to the sleep or wait commands that may be present in other operating systems. In the example below the timeout value is 2 minutes. In this case >> must be used to append to the output file, since > would overwrite the output file each time ping was run.

@echo off

set HostToPing="google.com"

:loop
set datetime=%date% %time%
for /f "tokens=9" %%g in ('ping %HostToPing% ^| find "Average ="') do echo %datetime% %%g >>ping_times.txt
timeout /t 120
goto loop

If I name the batch file avgpingtime.bat and run it from a command prompt, I would see the following until the batch file is stopped with Ctrl-C.

C:\>avgpingtime

Waiting for   0 seconds, press a key to continue ...

Waiting for   0 seconds, press a key to continue ...

Waiting for   0 seconds, press a key to continue ...

Waiting for   0 seconds, press a key to continue ...

Waiting for   0 seconds, press a key to continue ...

Waiting for   0 seconds, press a key to continue ...

Waiting for   0 seconds, press a key to continue ...

Waiting for   0 seconds, press a key to continue ...

Waiting for  14 seconds, press a key to continue ...

Until the batch file s terminated with Ctrl-C, it would display its countdown from 120 to 0 each time the timeout command is executed. The results stored in the text file would be similar to the following:

C:\>more google_ping_times.txt
Mon 06/15/2015 20:35:10.22 25ms
Mon 06/15/2015 20:37:13.15 33ms
Mon 06/15/2015 20:39:16.13 16ms
Mon 06/15/2015 20:41:19.12 22ms
Mon 06/15/2015 20:43:22.10 25ms
Mon 06/15/2015 20:45:25.13 22ms
Mon 06/15/2015 20:47:28.12 17ms
Mon 06/15/2015 20:49:31.12 20ms
Mon 06/15/2015 20:51:34.13 15ms
Mon 06/15/2015 20:53:23.37 20ms

The batch file could also be scheduled to run with the Windows Task Scheduler.

[/os/windows/commands] permanent link

Sun, Jun 14, 2015 10:37 pm

Configuring sendmail to accept email from other email servers

A default installation of sendmail usually yields a configuration where sendmail will only accept email from email clients on the server on which sendmail is running. Usually, you will want to allow external email servers to send email to valid email addresses on the server. To do so, edit /etc/mail/sendmail.mc. Comment out the following line by putting dnl at the beginning of the line:

DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

The line should then appear as follows:

dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

You then need to rebuild the /etc/mail/sendmail.cf file from the /etc/mail/sendmail.mc file using the m4 command as shown below:

m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

Once you've rebuilt the sendmail.cf file, you need to restart sendmail. You may be able to restart sendmail with a /etc/init.d/sendmail restart command, though on some Linux systems, e.g., CentOS 7, you will see a No such file or directory error message, if you try that command. On a CentOS 7 system, you can restart sendmail with systemctl restart sendmail.

# /etc/init.d/sendmail restart
-bash: /etc/init.d/sendmail: No such file or directory
# systemctl restart sendmail
#

Or you can also use service sendmail restart on a CentOS 7 system to restart sendmail.

# service sendmail restart
Redirecting to /bin/systemctl restart  sendmail.service
#

Once you've restarted sendmail, external servers sending email to domain names present in the local-host-names file, should no longer receive "relaying denied" error messages in bounced email. They still would not be able to send email to email addresses for domain names not in that file. I.e., the server won't function as an "open mail relay".

[/network/email/sendmail] permanent link

Sat, Jun 13, 2015 9:53 pm

Determining what package provides a file on a CentOS system

If you wish to know which package provides a particular file on a CentOS system, you can use the yum whatprovides command followed by the path to the file and its name. E.g., if I wanted to determine what package provides the mysql command on a system, I could determine its location with the which command and then use the yum whatprovides command to determine the package that included the file.
$ which mysql
/usr/bin/mysql
$ yum whatprovides /usr/bin/mysql
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.umd.edu
 * epel: mirror.us.leaseweb.net
 * extras: mirror.nexcess.net
 * updates: mirror.cs.pitt.edu
1:mariadb-5.5.41-2.el7_0.x86_64 : A community developed branch of MySQL
Repo        : base
Matched from:
Filename    : /usr/bin/mysql



1:mariadb-5.5.41-2.el7_0.x86_64 : A community developed branch of MySQL
Repo        : @updates
Matched from:
Filename    : /usr/bin/mysql

From the above output, I can see the mysql program was provided in the mariahdb package.

Another means to determine what package provided a file installed on the system is to use the RPM Package Manager (RPM) utility.

$ rpm -qf /usr/bin/mysql
mariadb-5.5.41-2.el7_0.x86_64

Details on that package could be obtained by using the rpm -qi mariadb command.

$ rpm -qi mariadb
Name        : mariadb
Epoch       : 1
Version     : 5.5.41
Release     : 2.el7_0
Architecture: x86_64
Install Date: Mon 16 Feb 2015 09:33:02 PM EST
Group       : Applications/Databases
Size        : 50862464
License     : GPLv2 with exceptions and LGPLv2 and BSD
Signature   : RSA/SHA256, Thu 05 Feb 2015 11:27:55 AM EST, Key ID 24c6a8a7f4a80eb5
Source RPM  : mariadb-5.5.41-2.el7_0.src.rpm
Build Date  : Thu 05 Feb 2015 11:12:40 AM EST
Build Host  : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Vendor      : CentOS
URL         : http://mariadb.org
Summary     : A community developed branch of MySQL
Description :
MariaDB is a community developed branch of MySQL.
MariaDB is a multi-user, multi-threaded SQL database server.
It is a client/server implementation consisting of a server daemon (mysqld)
and many different client programs and libraries. The base package

If you are interested in what package may provide a file that isn't currently installed on a system, you could use the yum whatprovides command or, alternatively use the www.rpmfind site to perform a search on the file name. In this case, for mysql, the site will return a long list of packages that could provide the file.

[/os/unix/linux/centos] permanent link

Sat, Jun 13, 2015 7:29 pm

Getting sendmail to accept email for a domain

In order to configure sendmail to accept email for a particular domain name, you need to add the domain name to /etc/mail/local-host-names. E.g., suppose sendmail on my server accepts email for moonpoint.com, but I also want it to handle email for example.com. I would then edit the /etc/mail/local-host-names file adding example.com to the the file, so it would contain the following lines:

# local-host-names - include all aliases for your machine here.
moonpoint.com
example.com

Any line that begins with the pound or hash character, i.e., #, is a comment and domain names are added one per line. After editing the file, you need to generate a new local-host-names.db file by running the command below from the root account:

# makemap hash /etc/mail/local-host-names < /etc/mail/local-host-names
makemap: /etc/mail/local-host-names: line 2: no RHS for LHS moonpoint.com
makemap: /etc/mail/local-host-names: line 6: no RHS for LHS example.com

Don't worry about the "no RHS for LHS" lines; they are to be expected. You can verify that your sendmail server will now handle email for the new domain by using the sendmail -bv command followed by the name of an account or alias on the system (aliases are added to /etc/aliases and a new aliases list generated by running newaliases). E.g., if jan is the name of an account on the system, I could then test that email will be delivered to the local jan account if I were to send a message to jan@example.com.

# sendmail -bv jan@example.com
jan@example.com... deliverable: mailer local, user jan

The "mailer local, user jan" reference informs me that sendmail will deliver email addressed to jan@example.com to the local jan account. When I ran the command prior to updating the local-host-names file, I saw the following:

# sendmail -bv jan@example.com
jan@example.com... deliverable: mailer relay, host smtp.mandrillapp.com, user jan@example.com

The "mailer relay" reference informed me that sendmail was not configured to deliver email to the local account if someone on the system sent email to jan@example.com, but would, instead, send the email through another email server to what it believed was an external email account.

To get external email servers to use the server on which I'm running sendmail to delier email for the example.com domain, I need to have an appropriate mail exchanger (MX) record configured for the domain - see Checking MX Records - or at least ensure that there is no MX record pointing to some other server. E.g., I could use the command nslookup -querytype=mx example.com to check the MX records for example.com.

# nslookup -querytype=mx example.com
Server:         10.255.176.37
Address:        10.255.176.37#53

example.com   mail exchanger = 10 smtp.example.com.

If my server running sendmail is accessible at the IP address for smtp.example.com, then other email servers will send email for any any email address at example.com to it.

[/network/email/sendmail] permanent link

Fri, Jun 12, 2015 10:12 pm

Port forwarding with PuTTY

The free PuTTY program for Microsoft Windows systems allows you to establish SSH connections. The program includes port forwarding capability, so that you can forward connectivity to a port on the system running PuTTY to a port on the SSH server to which you have connected using PuTTY or even another system accessible from the SSH server. E.g., suppose you can remotely connect to a SSH server at your home or business, but you can't access a web server at home or at the business location remotely. One option you can use is have PuTTY "listen" on the system on which it runs on a port, e.g., port 8888, and for any connection to that port on the local system on which PuTTY is running, forward the connection to the remote web server through the SSH server as explained at Port forwarding to another device with PuTTY. Such port forwarding can be performed to any TCP port.

Alternatively, you can set up a SOCKS proxy using PuTTY as noted at Using PuTTY to set up a SOCKS Proxy Connection. Instructions for configuring some browsers ito use a SOCKS proxy are provided from the links below:

[/os/windows/network/ssh/putty] permanent link

Mon, Jun 08, 2015 10:53 pm

AgentService CPU Utilization

I've found that a MacBook Pro laptop I use often will slow unbearably. When I check the cpu utilization, I usually find some third-party application is consuming an inordinate amount of CPU time slowing the system. Today the problem was due to the AgentService process associated with an enterprise backup program, Connected Backup, from Hewlett Packard (HP). HP acquired the software when it purchased Autonomy Corporation, which had itself obtained the software through the purhcase of Iron Mountain's technology arm, "Iron Mountain Digital". Previously, I've seen the same CPU utilization problem due to the AMPAgent process from Kace.

[ More Info ]

[/os/os-x] permanent link

Fri, Jun 05, 2015 9:46 pm

Removing email addresses, etc. stored within your browser

When you go to websites where a form is present with fields for an email address, etc., such as the Facbook page for logging into the site, when you click on the field for the email address you may see a list of email addresses that the browser has saved to auto fill fields in forms for you. If you wish to have the browser "forget" those email addresses and other information, the steps to take are as follows:

Chrome
Firefox

[/network/web/browser] permanent link

Wed, Jun 03, 2015 10:30 pm

Importing Amazon reports into Excel 2013

To import an Amazon affiliate report into Excel 2013, download the report as a tab separated values (TSV) report, then take the following steps in Microsoft Excel 2013 to import the data, which can also be used for any text file containing tab delimited data:
  1. Click on File.
  2. Click on Open.
  3. Under Open select the location where the downloaded file is located and select the report.txt file you downloaded.
  4. A "Text Import Wizard Step 1 of 3" window will open. You can check the check box next to "My data has headers". You can skip the first title row, if you wish, by changing the "Start import at row" value from the default value of 1. Click on Next when you've made any changes needed.

    Text Import Wizard Step 1 of 3

  5. At step 2, leave "Tab" selected as the delimiter and click on Next.

    Text Import Wizard Step 2 of 3

  6. At step 3, you can leave "General" selected for the "Column data format" and click on Finish.

    Text Import Wizard Step 3 of 3

Once the data is imported, you can click on the vertical lines between the column headers to adjust the width of individual columns to accomodate column titles and data. Or to have the text wrap within the current column width, you can click on a column designator, such as "A", "B", etc., or click on the "1" to the left of the first row to choose all columns on that row, and then right-click and choose Format Cells, Alignment, and then select Wrap Text under Text Control, and then click on OK.

To save the file in an Excel spreadsheet format, select File and Save As, select a location and name for the file, and then change the "Save as type" value from "Text (Tab delimited) (*.txt)" to "Excel Workbook (*.xlsx)" or other file type.

[/os/windows/office/excel] permanent link

Tue, Jun 02, 2015 11:15 pm

Importing a contact list from Outlook into Event Planner 2015

If you wish to import a contact list from Microsoft Outlook into Event Planner 2015, which is part of Hallmark Card Studio 2015, first export the contact list from Outlook into a format that Event Planner can import, such as a Microsoft Access .mdb, Excel .xls, or comma separated values (CSV) file, e.g., see Exporting contacts from Outlook 2010. Though, when I tried importing from a Microsoft Access .mdb file, a ODBC Microsoft Access Driver Login Failed window opened with the message "Unrecognized database format 'C:\Users\Jane\Documents\Contacts.mdb'" after I was prompted for a login name and password, so I exported the data as an Excel .xls file, instead. I was able to successfully import from an Excel .xls spreadsheet.

Once you have exported the data from Outlook, in Event Planner, click on File then select Import. When prompted to "Select the data source you are importing from, select "Access (*.mdb), Excel (*.xls) or Comma Delimited (*.csv) files". The other options are "Existing Event Planner installation" and "Outlook Express". Outlook Express is a different application than Outlook, though both were created by Microsoft, and stores information in its own format, which is not the one used by Microsoft Outlook, so you will need to import from an mdb, xls, or csv file.

Import Data Source

After clicking on Next, browse to the location of the file you exported, e.g. Contacts.xls, and select it then click on Next. You will then need to map fields from the imported file to Address Book fields in the Event Planner.

Import Address Book Fields

Some Outlook fields won't have an exact match with Event Planner fields. E.g., Outlook has a company name field for its contacts, whereas the Event Planner does not, so you will have to map a company name to last name. To perform the mapping, you will need to click on an entry in the left-most "Select a value from your database" column in the Import Address Book Fields window, then select an entry from "Choose the Address Book field to which you want to map the value", and then click on the Add button to complete the mapping. You may have to open the exported file in an application such as Excel to determine what the column headers are for entries to make an appropriate mapping. You may not even need to map some values if you feel you don't need them in the Event Planner contact list, e.g., "gender", "sensitivity", etc. have no comparable Event Planner fields.

Company name to last name mapping

You will need to do this for each entry in the left column

Note: Tested with Event Planner 2015 version 3.0.3.1, which is part of Hallmark Card Studio 2015, but may apply to other versions as well.

[/os/windows/software/graphics/Event-Planner] permanent link

Once You Know, You Newegg AliExpress by Alibaba.com

Shop Amazon Local - Subscribe to Deals in Your Neighborhood

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo