fbpx

How to SSH Between Two Linux Computers Without Needing a Password

1. ssh to server1

Connect to server1 and generate a public/private key pair.

1
2
3
ssh myusername@server1
password:
ssh-keygen -t rsa

When you run this command you will be prompted to answer several questions. Just hit enter each time until you are returned to a prompt.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Generating public/private rsa key pair.
Enter file in which to save the key (/home/local/myusername/.ssh/id_rsa):
Created directory '/home/local/myusername/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/local/myusername/.ssh/id_rsa.
Your public key has been saved in /home/local/myusername/.ssh/id_rsa.pub.
The key fingerprint is:
15:68:47:67:0d:40:e1:7c:9a:1c:25:18:be:ab:f1:3a myusername@server1
The key's randomart image is:
+--[ RSA 2048]----+
|        .*Bo=o   |
|       .+o.*  .  |
|       ...= .    |
|         + =     |
|        S +      |
|         .       |
|      . .        |
|      E+         |
|      oo.        |
+-----------------+

Now you will need to copy the public key you just generated and save it somewhere, you will need it later. Also ensure when you copy the key that the text is all on one line, if there are line breaks in the text, it will cause problems later when you try and use the key.

1
2
3
4
5
6
7
cd .ssh
cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAyFS7YkakcjdyCDOKpE4RrBecRUWShgmwWnxhbVNHmDtJtK
PqdiLcsVG5PO94hv3A0QqlB1MX33vnP6HzPPS7L4Bq+5plSTyNHiDBIqmZqVVxRbRUKbP44BaA9RsW2ROu
8qdzmXRPupkyFBBOLa23RJJojBieFGygR2OwjS8cq0kpZh1I3c1fbU9I5j38baUK0naTBe2v7s/C8allnJ
hwkfds+Q9/kjaV55pMZIh+9jhoA8acCA6B55DYrgPSycW6fEyV/1PIER+a5lOXp1QCn0U+XFTb85dp5fW0
/rUnu0F9nBJFlo7Rvc1cMuSUiul/wvJ8tzlOhU8FUlHvHqoUUw== myusername@server1

2. ssh to server2

Now we will copy the public key from server1 to server2.

1
2
3
4
5
6
7
ssh myusername@server2
password:
mkdir .ssh
cd .ssh
vi authorized_keys
# paste the public key
chmod 600 authorized_keys

3. Test that your setup is working

1
2
3
4
ssh myusername@server1
password:
ssh myusername@server2
# you should not be prompted for a password!

Autologin for Windows Server

(From the Microsoft Site) To use Registry Editor (Regedt32.exe) to turn on automatic logon, follow these steps:

Click Start, and then click Run.
In the Open box, type Regedt32.exe, and then press ENTER.
Locate the following subkey in the registry:
HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionWinlogon
Double-click the DefaultUserName entry, type your user name, and then click OK.
Double-click the DefaultPassword entry, type your password, and then click OK.NOTE: If the DefaultPassword value does not exist, it must be added. To add the value, follow these steps:
On the Edit menu, click New, and then point to String Value.
Type DefaultPassword, and then press ENTER.
Double-click DefaultPassword.
In the Edit String dialog, type your password and then click OK.
NOTE: If no DefaultPassword string is specified, Windows automatically changes the value of the AutoAdminLogon key from 1 (true) to 0 (false), disabling the AutoAdminLogon feature.

On the Edit menu, click New, and then point to String Value.
Type AutoAdminLogon, and then press ENTER.
Double-click AutoAdminLogon.
In the Edit String dialog box, type 1 and then click OK.
Quit Registry Editor.
Click Start, click Shutdown, and then type a reason in the Comment text box.
Click OK to turn off your computer.
Restart your computer. You can now log on automatically.
Notes To bypass the AutoAdminLogon process and to log on as a different user, hold down the SHIFT key after you log off or after Windows restarts.

Registry change will not work if the “Logon Banner” is defined on the server either by a Group Policy object (GPO) or by a local policy. When policy is changed to not impact server, the feature works as expected.

An interactive console logon that has a different user on the server changes the DefaultUserName registry entry as the last logged on user indicator. AutoAdminLogon relies on the DefaultUserName entry to match the user and the password. Therefore, AutoAdminLogon may fail. You may configure a shutdown script to set the correct DefaultUserName entry for AutoAdminLogonAs. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

119364
(http://support.microsoft.com/kb/119364/ )
AutoAdminLogon loses DefaultUserName

Error Installing a Botched Installation of VMware Tools

A previous installation of VMware Tools has been detected.
The previous installation was made by the tar installer (version 4).

Keeping the tar4 installer database format.

You have a version of VMware Tools installed. Continuing this install will
first uninstall the currently installed version. Do you wish to continue?
(yes/no) [yes]

If you select yes, the following error message appears:
Error: Unable to find the binary installation directory (answer BINDIR)
in the installer database file “/etc/vmware-tools/locations”.
Uninstall failed. Please correct the failure and re run the install.

Execution aborted.

To solve this issue, remove the /etc/vmware-tools/locations file and reinstall VMware Tools.

Cloning WordPress Installations

I don’t know about you, but after beating my head against the wall a few days trying to figure out how to import/export data through my development environment to production, using vmware clones, and other various methods, I found this tool that makes my job much easier. Please check out the link and see what you think!

http://interconnectit.com/products/search-and-replace-for-wordpress-databases/

Moving WSUS Content / Databases

The following procedures will help you overcome low disk space problems:

· Using the Server Cleanup Wizard to remove unneeded content.

· Moving the content directory to another drive

· Moving the SQL Server database to another drive

To use the Server Cleanup Wizard to remove unneeded content

1. In the WSUS administration console, select Options, then Server Cleanup Wizard.

2. By default this wizard will remove unneeded content and computers that have not contacted the server for 30 days or more. Select all possible options, then click Next.

3. The wizard will begin the cleanup process, and will present a summary of its work when it is finished. Click Finish to complete the process.

To move the content directory to another drive

1. Create a new content directory on another drive.

2. Locate the WSUSUtil.exe utility in the Tools directory of your WSUS installation (typically C:Program FilesUpdate ServicesTools).

3. Open a command window, navigate to the Tools directory, and type the following:

4. wsusutil movecontentNewContentPathMoveLog

5. where NewContentPath is the new content directory, and MoveLog is the path and filename of the log for this operation.

Note

For more information on using the WSUSUtil utility, see Managing WSUS 3.0 from the Command Line in the Operation Guide

To move the SQL Server installation to another drive

1. Open a command window.

2. Type net stop wsusservice

3. Detach the SUSDB database.

4. Copy SUSDB.mdf and SUSDB_log.ldf to the new location.

5. Attach the SUSDB database from the new location.

6. Type net start wsusservice

7. When the system is working properly, delete SUSDB.mdf and SUSDB_log.ldf from the old location.

Port Mirroring on a Force10 S50v

I wanted to mirror the traffic received and sent on port 0/48 of the Force10 S50v switch to port 0/44 on the same switch. Notice that I do not have to add port 0/44 to any vlan in order to use it for the destination for port mirroring; however, I do have to make sure it has “no ip address” and “no shutdown” configured. Now that all the physical connections are made, I setup port mirroring on the Force10 S50v switch as shown below.

————————————————————————————————————
– enable
– config
– monitor session 0
– source gigabitethernet 0/48 destination gigabitethernet 0/44 direction both

Once I get around to setting up the lagg, I would change the monitor session 0 to

source port-channel 128 destination gigabitethernet 0/44 direction both

Shadow a VMware View Desktop Session

In VMware View there is no central way shadow a desktop session such as for example in Citrix XenApp. It would be nice if in the future it is possible to shadow a desktop from for example the VMware View Connection server. This is a frequently asked question by customers where VMware View is implemented.

The following steps must be taken to shadow a PCoIP session from the vSphere Console by using a GPO:

Use VMware vSphere 5 and VMware View 5 or greater (in vSphere 4 there is a registry hack available)
For Windows 7 be sure to use Hardware Version 8. For Windows XP or Vista you can use any hardware version
Create a new Group Policy Object (GPO)
Add the “pcoip.adm” file to the Computer Configuration. The ADM file can be found on the VMware View Connection server in the “C:\Program Files\VMware\VMware View\Server\extras\GroupPolicyFiles” folder
Enable the “Enable access to PCoIP session from a vSphere console” in the Computer Configuration settings.
pcoip1

Link the GPO to the OU were the VMware View Windows 7 desktop resides
Sync Domain Controllers
Restart the VMware View desktop
After configuring this, it is possible to shadow a PCoIP session from the vSphere Console. The user doesn’t need to approve the shadow session so this could be security and privacy issue. The keyboard and mouse movements are displayed on the two screens synchronously, although, there is a bit of a delay.

Locked Out of WordPress due to Google Authenticator

Locked OuI got locked out of my WordPress Site recently due to messing about with Google Authenticator and I needed to disable the plugin.
To do this, open an FTP session to your WordPress and locate the folder below

/wp-content/plugins/google-authenticator

If you rename the ‘google-authenticator’ folder to ‘_google-authenticator’ this will disable the plugin.

Login to your WordPress as normal then open the plugins.

Now from the FTP rename the ‘_google-authenticator’ back to ‘google-authenticator’ and in your web-browser click the plugins tab again the google-authenticator plugin will now be de-activated, you can re-activate it and go into your user account to re-configure.

If you watch this video from beginning to end on Google Authenticator it does step you through setting-up another admin account while you test everything in case this happens so you do not lock yourself out. You then delete the second (non Google Authenticator active) admin account once you have everything verified working okay.

See the video guide here :- http://www.mocialsedia.com/installation-essentials-for-wordpress/ it is the last one on the page video 3 on Google Authenticator.

How to Change Port RDP Listens On

To change the port that Remote Desktop listens on, follow these steps.
1. Start Registry Editor.
2. Locate and then click the following registry subkey:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TerminalServer\WinStations\RDP-Tcp\PortNumber
3. On the Edit menu, click Modify, and then click Decimal.
4. Type the new port number, and then click OK.
5. Quit Registry Editor.
6. Restart the computer.

Note When you try to connect to this computer by using the Remote Desktop connection, you must type the new port. Maybe you have to set the firewall to allow the new port number before you connect to this computer by using the Remote Desktop connection.