Teamviewer and RDP

Using Teamviewer with RDP in Windows you may receive the following error when an RDP session is closed or minimised.

The screen cannot be captured at the moment. This is probably due to fast user switching or a disconnected/minimized remote desktop session

To get around this make sure Teamviewer is installed then:

1. Get the server ID from either Help > About Teamviewer or click on the bulb icon next to the ID
2. Set the unattended password in Extras > Options > Security.

Tested as of Teamviewer 11

Beanstalkd and Multiple Laravel Websites

If you have multiple websites on the same server using Beanstalkd for queues you can set unique queue tubes for each site to prevent jobs on the queue being triggered by the other sites.

In Laravel, edit the queue config file and change default to something unique like the website name.

'beanstalkd' => [
            'driver' => 'beanstalkd',
            'host'   => 'localhost',
            'queue'  => 'default',    
            'ttr'    => 60,

Allow PHP Hook Script to Run for Git

Suppose we have a deploy.php script at /var/www/html/deploy.php that is called by a hook from a service such as Github or Bitbucket.

We need to configure our web-server user, in this case it’s www-data, who’s default home directory is /var/www.

Create .ssh directory and set permissions

mkdir /var/www/.ssh
chmod 0700 /var/www/.ssh
chown -R www-data:www-data /var/www/.ssh

Create the SSH keys and restrict permission on the keys, chmod 0700 above allows the server write to the known_hosts file which will be created within this directory also. Although you cannot switch session to the www-data user as it has no bash shell you can execute commands as the user using sudo -u www-data.

sudo -u www-data ssh-keygen -t rsa
chmod 0600 /var/www/.ssh/id_rsa
chmod 0600 /var/www/.ssh/

Add the public key to the repository host service, i.e. Github, Bitbucket. Copy key from

cat /var/www/.ssh/

Add service to the www-data known_hosts file, in this case Bitbucket

sudo -u www-data ssh -T [email protected]

Pull Only 1 Directory From Git Repository

This can be done by setting up a sparse checkout. Sparse Checkout

Create a directory

mkdir [directory]

Enter directory

cd [directory]

Git init and add remote

git init
git remote add origin [url]

Enable sparse checkout

git config core.sparseCheckout true

Set folders to checkout in .git/info/sparse-checkout

echo "[wanted directory]" >> .git/info/sparse-checkout

Then pull the repository

git pull origin master

This method will pull the whole repository but will only checkout the configured directories.


Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is

If you receive the above message when attempting a SSH connection it may be down to the host IP changing. If this is expected you can remove your known_hosts file or use:

ssh-keygen -R [hostname/IP address]

to remove the entry from the known_hosts file.