Changing the RDP Port on Windows 10

By default, remote desktop connections on windows use port 3389. If you find the need to change this port, the following should help. Make sure you have “Allow remote connections to this computer” checked under “System Properties > Remote” before you begin.

In my experience, you should avoid changing the mapped port for core Windows services if possible, as this can cause numerous configuration and management issues. Other options include:
– Using port mapping (forwarding) on your router (e.g. externalip:10000 -> serverip:3389), however not all routers offer this functionality.
– Using a third party remote desktop app, like Chrome Remote Desktop or LogMeIn, however these require specific software and/or subscriptions
– Using a server/PC as a RDP “gateway”. You then access all further RDP hosts from this first point of contact.
– Using a RD gateway/RD Web access. This requires a server with the appropriate role installed, but can optionally be configured with two-factor authorisation like Duo.

To check what port your RDP is currently listening on, use the netstat command in an elevated command prompt.

netstat -abo

This will show information about current network connections and listening ports, as well as associated executables and processes. You’ll see port 3389 bound to “svchost.exe” on “TermService”.

RDP on port 3389

 

To change the bound port you’ll need to open an elevated command prompt and run regedit.

regedit

Navigate to the PortNumber setting.

HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Control > Terminal Server > WinStations > RDP-Tcp

Right click on the “REG_DWORD” named “PortNumber” and hit “Modify”. Change the base to Decimal and enter the new port (between 1025 and 65535). You can use NetStat to check if a particular port is already bound to a process.

Once you’ve changed the value, exit RegEdit and either reboot the computer, or simply restart the Remote Desktop Services service using the “Services” snap-in in “Computer Management”. You can confirm the port has been changed by running netstat again (in my case, to 10000).

RDP on port 10000

Finally, open up Windows Firewall and add a new inbound rule for the new port. You won’t be able to change the existing rule as that’s a core system rule, but copy across the values into a new rule and you’ll be good to go.

Mediatemple Grid Server (gs) MySQL and Support Problems

Let me be honest, I really REALLY want to like Mediatemple. Their website is extremely well designed, there’s loads of support information in their customer area, their GPU system gives you detailed information on high-resource scripts and files on your server and their file system has excellent uptime and good speeds.

Mediatemple GS Control Panel

However, as I write this one of our personal projects which we put on it’s own Mediatemple server is displaying a MySQL connection error – again. Over the last week it’s been a constant on/off battle made many times worse by the very slow Mediatemple support.

Mediatemple Sport a Speedy 20Hr Response Time

It was acceptable to begin with, 5 hours for the first reply, 13 hours for the second that informed me there was a bigger issue (mediatemple always seem to have MySQL issues), 7 hours later they informed me the issue had been fixed.

25 hours later (yes, TWENTY FIVE), after I had replied saying there was still a problem, they told me it was all running ok…which it was THEN but it had been too slow to work for hours before they replied.

I should probably point out that all of this was mid-week so the only reason I can see for the slow responses is that everyone was busy working on the problem?

Mediatemple Support Home

In the past I have had timely replies to my tickets (2 hour average) which is not as good as some (VPSLatch and PowerVPS being the best I’ve seen) but decent. In fact the response time is estimated at 4 hours 28 mins in the control panel right now. I have had only one instance of downtime for my files but unfortunately there are a couple of other shortcomings of their system including overly complicated domain setup (for subdomains) and how they work with the system. Whereas cPanel (for example) has seperate stats and settings for each domain, Mediatemple’s control panel mixes them together so the Urchin stats show all sites as one.

This post isn’t completely one sided, as the amount of space & bandwidth you’re given is very generous; along with the actual computing ‘budget’ they provide you with being pretty high (with their GPU system). Their website is beautifully designed and works pretty well but is let down by their MySQL system and slightly confusing control panel. You can of course fix the MySQL fault by purchasing a MySQL container at $20/mo, offering excellent response times; but this doubles the monthly cost of the service.

Extra MySQL Packages Are Available

I’d also point out that the Mediatemple terms of use are similar to those found on VPS and dedicated servers, much more relaxed than shared servers. This is still very useful (combined with the high storage space and inclusive bandwidth) for image hosting sites etc that you can’t put elsewhere.

Hopefully this has given you a fairly round view of my time with mediatemple, everybody’s views differ and you’ll have a different experience depending on what cluster you’re on; but I’d suggest a VPS is a better way to go until Mediatemple sort out the annoying MySQL lag.

SPF Records for Google Apps Hosted Mail – avoiding rejected emails

Using Google Apps for your domain’s email? Well you definately need to set up some SPF records.
Reason I’m posting this? Made this mistake myself and had quite a few bounced emails! It seems yahoo is extremely strict when it comes to checking for SPF records on a domain, and bounces anything with missing records. Many other email providers like hotmail simply SPAM your message straight away.

Google provide the following resource for this problem: http://www.google.com/support/a/bin/answer.py?hl=en&answer=33786

But, they recommend using

v=spf1 include:aspmx.googlemail.com ~all

That’s all fine and well…but what about the official website? Oddly, they recommend using – instead of ~ (http://www.openspf.org/FAQ/Common_mistakes)

v=spf1 include:aspmx.googlemail.com -all

But seeing as it’s google hosting my mail, I’ve been using ~ successfully for some time now, with no more bounces.

Testing whether you’re configured correctly

Easy, just send an email to spf-test@openspf.org and you’ll get a bounce right back with the SPF status in (http://www.openspf.org/Tools).

How can I configure my server?

If you have access to all your DNS records for your domain you can add it yourself (for example through WHM or root plesk panel) but on most shared hosts just fire off an email to the support team who will add the record for you.

On Plesk & Cpanel you can add either a SPF record or a TXT record through your DNS editor, making it easy to do this yourself.

Automatic Local, FTP & Email Backups of MySQL Databases with Cron

I’ll start by saying this is not all my own code, it is based on dagon design’s original release in 2007 (Automatic MySql Backup Script) but this version builds on their version 2.1 to add FTP support.

What this script can do:

  • Backup all of your MySQL databases on a server individually, then package them into a single tar.
  • Save that tar locally, on a FTP server or even email it to you

What you need:

  • PHP
  • MySQL
  • Preferably the root mysql login & password (allows you to backup all databases in one go)

I do not guarantee:

  • That this will definately work on your server, or Windows servers out of the box.

However it is here for people to use. I have tested it on several linux machines and it runs great.

Download:

Zip containing dbbackup.php & dbbackupconfig.php – dbbackup.zip

What I’ve added:

To upload to a remote FTP server, I added this to the config file:

######################################################################
## FTP Options
######################################################################

// Use FTP Option?
$useftp = true;

// Use passive mode?
$usepassive = true;

// FTP Server Address
$ftp_server = 'host';

// FTP Username & Password
$ftp_user_name = 'username';
$ftp_user_pass = 'password';

and this to the main file below email sending:

// do we ftp the file?
if ($useftp == true) {
$file = $BACKUP_DEST.'/'.$BACKUP_NAME;
$remote_file = $BACKUP_NAME;

// set up basic connection
$conn_id = ftp_connect($ftp_server);

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

// turn passive mode on?
ftp_pasv($conn_id, $usepassive);

// upload a file
if (ftp_put($conn_id, $remote_file, $file, FTP_BINARY)) {
 echo "successfully uploaded to ftp: $remotefile\n";
} else {
 echo "There was a problem while uploading $remotefile\n";
}

// close the connection
ftp_close($conn_id);
}

That’s all!

Godaddy FTP Backup Servers – Dedicated Plesk Server

One of our clients recently had an issue where his Godaddy FTP Backup Server was full – causing his seperate dedicated Plesk Server to fill up it’s own Drive with Temp files, while at the same time use a lot of resources trying to put files to the full FTP backup server.

You can sign up for a remote backup server when you order a godaddy hosting service, and it does sound a good idea considering it should keep your data safe. You can only access the data on the FTP server from within the Godaddy network – stopping any outside access.

When Plesk attempts to connect to a remote FTP server, it first tries to place a file on the server – which is a no-go if the server is full. This fails of course, so you can’t even get a directory listing of the remote server through Plesk.

Easy solution though – connect to your server through SSH and then use commands to connect to the remote FTP through your server.

  1. Open your SSH application of choice (we use PuTTY, available free from greenend.org.uk) and connect to your server. Use your main IP address or your hostname (domain name), depending on what your host supports. For dedicated servers from Godaddy, either can be used.
  2. Once you’ve logged in with your root username and password, simply enter

    FTP XXX.XXX.XXX.XXX (where xxx…. is the IP address of the FTP server) and hit enter.
    then your login username, hit enter and then your login password (also followed by enter). For Godaddy all of this is available in your Server Management Area.

  3. Now you should be logged on to the server. Type DIR and hit enter to produce a list of the directory contents. This also shows file sizes and other details.
    1. You can DELETE individual files on the server using the DELETE command. For example, to delete info.php use DELETE info.php and hit enter.
    2. To change directories type CD directoryname/ and hit enter.
    3. To copy a file to your local server type WGET filename.file and hit enter. If you don’t specify a directory then the file will be copied to your server in the /root/ directory. You can access this directory by connecting to your server using PuTTY and typing DIR and hitting enter when you’ve logged in. (It will be in the default directory).

That’s a basic guide, there are many better out there but this follows the basics. There are a couple of useful SSH commands on this site, including how to set specific options.