CentOS – create a swap file.

I have done a few times before but don’t have to do it very often, just noting it here.

Create an empty file. The following will create a 1GB file.:

# dd if=/dev/zero of=/var/swapfile bs=1024 count=1024000
1024000+0 records in
1024000+0 records out
1048576000 bytes (1.0 GB) copied, 10.9243 s, 96.0 MB/s

Change the permission:

# chmod 0600 /var/swapfile

Create the swap area:

# mkswap /var/swapfile
Setting up swapspace version 1, size = 1023996 KiB
no label, UUID=957c2a0c-30f9-4dd7-89ed-d88b9f471294

Enable the swap area:

# swapon /var/swapfile

Enable the swap area at boot by adding it to the /etc/fstab:

# vi /etc/fstab

/var/swapfile swap swap defaults 0 0

Disable the swap area:

# swapoff /var/swapfile

Cisco and SCP Notes

Using scp top copy configuration files and update software on Cisco equipment is a much better and secure way than tftp/ftp. Here are the basics for a couple Cisco devices.

ASA 5525:
To enable scp on a Cisco ASA running version 9.x:
(config)# ssh scopy enable

To harden ssh on a Cisco ASA running version 9.x:
(config)# ssh stricthostkeycheck
(config)# ssh timeout 60
(config)# ssh version 2
(config)# ssh cipher encryption medium
(config)# ssh cipher integrity medium
(config)# ssh key-exchange group dh-group14-sha1

How to copy a running configuration using scp:
# copy system:/running-config scp://username@aaa.bbb.ccc.ddd/myconfigname.cfg

3750 Switch Notes:
To enable scp on a 3750 switch:
#ip scp server enable

How to copy a running configuration from the ASA using scp:
#copy system:/running-config scp://username@aaa.bbb.ccc.ddd/myconfigname.cfg

How to copy from remote linux client:
# scp username@aaa.bbb.ccc.ddd:system:running-config .

Protected: ASA Clue

This content is password protected. To view it please enter your password below:

Manually Configure IP address in CentOS7/RHEL7.

Let me just preface this post by saying “This is not a persistent configuration. If you boot the system, these settings will be lost unless you save them via the /etc/sysconfig/network-scripts files or through NetworkManager.

Here is how you can manually configure the IP address and gateway in CentOS/RHEL7:

Configure the IP address and subnet mask:

# ip addr add aaa.bbb.ccc.ddd/ss dev interface

For example:

# ip addr add dev eno1

Likewise, to remove the IP address:

# ip addr del dev eno1

To configure the default gateway:

# ip route add default via ddd.ccc.bbb.aaa dev interface

For example:

# ip route add default via dev eno1

Same kind of thing to remove the currently configured gateway:

# ip route del default via dev eno1

Once you have the interface configure, bring it up:

# if link set eno1 up

And to take it down:

# if link set eno1 down

Exchange View the Mailboxes a User has Permission to Access

Exchange via EMC:

This will search all of the mailboxes to determine which a user has FullAccess permissions:

[PS] > Get-Mailbox | Get-MailboxPermission | Where { ($_.AccessRights -eq “FullAccess”) -and ($_.User -like “DOMAIN\USER”)} | FormatList

RunspaceId : 12345678-1234-5678-9012-123456789012
AccessRights : {FullAccess}
Deny : False
InheritanceType : All
Identity : DOMAIN.LOCAL/Users/Firstname Lastname
IsInherited : False
IsValid : True

It can take a while, but it will give you the results.

Mounting Shares via Windows Alternate Names In Linux

On the server you want to mount a share, use the following list all names for the server:



C:\>netdom computername dc01 /enum
All of the names for the computer are:

The command completed successfully.

To add a new name:

NETDOM COMPUTERNAME servername /ADD othername.domain.tld

And then to get the name registered into your DNS:


Now, when you list the names, you will see the new one:

C:\>netdom computername dc01 /enum
All of the names for the computer are:

The command completed successfully.

To delete a name:

NETDOM COMPUTERNAME servername /REMOVE othername.domain.tld

When using Samba in linux to mount via an alternate server name, you need to make sure you specify the SMB version as a option.

For example:


//othername.domain.tld/sharename /MountPoint cifs vers=3.0,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0

Windows 2016 Create a Service

To run a program as a service, bring up an Administrator command prompt and:

C:\> SC CREATE “JGZs Service” binPath=”C:\MyPrograms\JGZsService.exe”

Then you can start the service via the SC command:

C:\> SC START “JGZs Service”

Or from the Services Control Panel applet.

Windows Server 2016 Proxy Settings For Local Computer

To set the proxy for all users that logon to Windows Server 2016 or Windows 10, you can configure your settings in Internet Explorer or through Internet Options from a Administrator level account on the machine.

Then, bring an Administrator command prompt and enter the following:

C:\>netsh winhttp import proxy source=ie

Turn off Server Manager startup at logon.

In Windows 2016, Server Manager starts up at logon. It does this in Windows 2012 R2, but I have not confirmed whether the solution is the same to prevent this behavior. To stop this, you do from the Task Scheduler.

You bring up Task Scheduler under Administrative Tools.

Expand Task Scheduler Library/Microsoft/Windows, and go down to ServerManager.

Under Server Manager, you will see two tasks: CleanupOldPerfLogs and ServerManager.

Right mouse click ServerManager and select Disable. This will turn this behavior off for all users that login to the server.

I have verified that can be modified the same way in Server 2012 R2 as well.

Using puttygen to generate OpenSSH public key

I was given the private key for an SFTP server on a remote network. The key was generate using puttygen.exe or similar program on a Windows system. I needed to using public key authentication to access the server. This is what I did to generate a public key to authenticate.

On a Windows system, I ran puttygen.exe and imported the private key. You can either do this as a parameter to the puttygen.exe program or import the key once you have started puttygen.exe:

puttygen somebodys.ppk

Once the key is imported, you can change the key comment from imported-openssh-key to something more meaningful. And enter and confirm your choice of passphrase.

Then save the public key by clicking the button.

Copy the newly generated public key to the openssh sftp client machine.

Put the file in file in the ~/.ssh directory and secure it (chmod 400 ~.ssh/somebodys.pub).

Then you just have to pass it to your sftp command.

$ sftp -i ~/.ssh/somebody.pub myusername@their.host.name

Return top