Can you copy SSH keys to new PC? (Windows or Linux)

You dont need to generate new SSH keys when switching or upgrading to new PC.

Copying SSH Keys to a New PC: Windows and Linux

On Linux:

  1. Locate Your SSH Keys: Your keys are usually in the ~/.ssh/ directory.
    ls -al ~/.ssh
  2. Copy the Keys: Use a USB drive or a secure transfer method. If using scp:
    scp -r ~/.ssh username@newPC_IP:~/
  3. Set Permissions: On the new PC, set the correct permissions:
    chmod 700 ~/.ssh
    chmod 600 ~/.ssh/id_rsa
    chmod 644 ~/.ssh/id_rsa.pub
  4. Test the Connection:
    ssh -T git@github.com

On Windows:

  1. Locate Your SSH Keys: If using Git Bash, your keys are typically in C:\Users\YourUsername\.ssh\.
  2. Copy the Keys: You can copy the .ssh folder to a USB drive or use file transfer methods.
  3. Paste to the New PC: On the new PC, paste the .ssh folder into C:\Users\YourUsername\.
  4. Permissions: You do not need to set permissions on Windows. Just ensure your private key (id_rsa) remains secure.
  5. Test the Connection:
    ssh -T git@github.com

Notes:

  • Ensure Security: Keep your private key secure and do not share it.
  • SSH Agent: If you use an SSH agent, you may need to add your key again on the new PC with ssh-add.
  • Update Public Key: If necessary, copy the contents of id_rsa.pub and update it in your Git service account settings.

Create and use SSH key to login to your server

OK, this is one of those posts where I am mostly writing down what I did to remember it for next time and not one of those generic advices with all kinds of options. Hope it still helps you.

Generating SSH keys

Let say you want to connect to your hosting server with your computer (Windows) using SSH keys and not use password anymore. Passwords are annoying and less secure.

Open the Windows Terminal and type ssh-keygen

You will be prompted to specify the location and filename for the key pair. By default, it will be saved in the user’s home directory under `C:\Users\\.ssh\`. I just pressed enter.

Next, you’ll be prompted to enter and repeat a passphrase for the key. If you want you can create one but I just pressed enter twice to skip it. SSH key pair will now be generated: a private key (`id_rsa`) and a public key (`id_rsa.pub`).

You can now use the public key (`id_rsa.pub`) for authentication purposes with remote servers or services. The private key (`id_rsa`) should be kept secure and not shared with anyone.

Adding public SSH key to your hosting account via Cpanel

Login to you hosting account’s Cpanel and click on ‘SSH Access” then “Manage SSH Keys” and then “Import Key”.

Now you can go back to Windows and open that id_rsa.pub file and copy the content of it or you can type this in terminal (assuming the name of your public SSH key id_rsa.pub):
clip < C:\Users\\.ssh\id_rsa.pub

keep in mind you have to use path and name of file on your computer, not just copy paste the above.

Then go back to cpanel’s “Import SSH Key” page and give it a name (like My PC), input your passphrase (if you have one) into passphrase field and then paste the public key into field for public key. I left private key field empty. Click Save or Import.

You will be taken to Public Keys page. If your key is NOT authorized then click Manage next to your key and click Authorize and save.

Connect to server via terminal

In your server’s Cpanel you should find username, IP and maybe port. Then you type:’

ssh username@SERVER-IP:port

hit enter and you should connect to server without the need for password.

Disable new Windows context menu

I am not really a fan of new windows (10,11) context menu because it somehow always seems that things I need require an additional click. It is quite annoying to have to click on “Show more options”:

windows 11 context menu

In my previous post, I taught you How to add “Open Cmder Here” in context menu on Windows. Of course it is not in new context menu, it is in the “old’ one which needs another click on the “Show more options” menu option.

Somehow Windows doesnt allow us to revert back to old menu or even add menu items. There are many step by step tutorials on net on how to do it manualy in registry but here is the easiest one I found. One command for disabling this new context menu and one for enabling it back.

Paste this code into a command prompt (cmd) or press Windows key + R and past it there

Disable new context menu

reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve

You will need to restart Explorer shell to take effect in both cases – or just restart Windows.

Restore new context menu

reg.exe delete "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}" /f 

Now the easiest way to restart Explorer shell is to press Ctrl+Shift+Esc to open the Task Manager, then right-click Windows Explorer and select “Restart” to restart it.
restart explorer
Another alternative is to simply restart Windows.

How to add “Open Cmder Here” in context menu on Windows

Cmder is a powerful command-line interface (CLI) tool for Windows operating systems that aims to enhance the overall command line experience. It provides a comprehensive collection of Unix-like commands, as well as a customizable console emulator that supports multiple tabs and a streamlined user interface.

If you want to add Open Cmder Here in context menu on Windows in a chosen folder then this is what you need to do:

  1. Open a terminal as an Administrator. It can be cmder or Windows cmd, it doesn’t matter.
  2. Navigate to the folder you have placed Cmder. (where you keep cmder.exe file)
  3. Run this command : .\cmder.exe /REGISTER ALL

If you get an “Access Denied” message, make sure you are executing the command in an Administrator prompt.

In a file explorer window right click in or on a directory to see “Cmder Here” in the context menu. If you are on Windows 10 or 11 you probably wont see it immediately. You have to click “Show more options” first and then you will see it there.

Disable This app is preventing shutdown message in Windows 11/10

This is one of the more annoying features of Windows since forever. You restart or shutdown PC, only to be greeted with this kind of message:

Even worse, Windows is saying it is closing apps but many times it never closes them. Countless times I did a shutdown, went away (or even left it overnight) much later and this wwindow was still on!

I get it, this is suppose to prevent us losing some important work but I cant remember when I needed this. Even if you click Cancel it will shutdown sometimes.

Unfortunately, Microsoft doesn’t provide an easy solution/checkbox in settings. Here is how to fix it. You will need to edit registry but it is not hard.

Important: Please only do this if you know what you are doing. Call someone who knows if you don’t. You can mess up Windows if you do something wrong in Registry. I cant be responsible if something goes wrong. Thank you for understanding 🙂

1. Open registry editor.

Click on Start Menu or Search icon and just type “registry” then click on registry editor app. If Windows asks you for permissions just click YES.

2. Navigate to (open):

Computer\HKEY_CURRENT_USER\Control Panel\Desktop

3. In the right panel, right click the empty space and choose New > String. and name it AutoEndTasks. That is important, it has to be named exactly like this.

4. Double click newly created AutoEndTasks (REG_SZ) and set its Value data to 1.

Click OK, close Registry editor, restart Windows.

Note: When you restart Windows after what you just did, you might still get this annoying notice “This app is preventing shutdown message” because Windows has not yet reloaded Registry. Next time you restart or shutdown Windows you should not see this message.

If this doesn’t work, try creating DWORD Value in step 3. For me, DWORD Value didn’t work. Only after I created String value it worked.

Laravel Composer using the wrong PHP version

I installed WAMP for offline development, then Composer and then Laravel. Everything was OK until I used Composer to download some Laravel package and I got this kind of error:

This package requires php >=7.0.0 but your PHP version (5.6.25) does not satisfy that requirement

Number don’t matter but I needed newer PHP. OK, I changed PHP version on WAMP, restarted it..and Laravel composer gave me the same error!

Long story short, after an hour of googling and trying all the suggested solutions like editing composer.json and this and that, nothing worked!

The solution is simple: reinstall Composer! D’oh!

When you run setup you can select the PHP version you want Composer to use (of course you have to have this PHP version installed on your PC or server) and the Composer will use it from then on:

 

laravel composer php version

After doing this this I was able to install the package. To be honest, I was quite upset that so many people offered some complicated solutions (that didn’t even work for me) on various forums and wasted my time when the solution was so simple.

 

 

 

Cmder displays {lamb} and {git} instead of λ and current dir

I recently installed cmder for Windows and when I ran it it was displaying {lamb} and {git} instead of λ and current dir.

Cmder displays {lamb} and {git} instead of λ and current dir

It came with the 0.4.2 version of Clink , which apparently is incompatible or doesnt work best with Windows 10.

Solution is very simple:

1. Go to https://mridgers.github.io/clink/ and download ZIP version of  Clink (.exe is probably OK too but I downloaded ZIP). The new version I downloaded was 0.4.9.

2.  Go to the cmder_mini/vendor folder (where you installed cmder) and rename clink folder to something like clink_original (or you can delete it if you like but I prefer to backup first if something goes wrong) and recreate a folder named clink  and simply extract all files from the downloaded ZIP to this folder.

3. Close (if you had it open) and restart cmder and this is what you should see:

cmder clink

Prevent Windows from updating/reinstalling a driver

This is for Windows 10 but will probably work on other Windows versions too.

Windows 10 is still relatively new so some vendors (looking at you Lenovo) haven’t updated the drivers. For example in my case I had problems with Conexant driver for Windows 10 – microphone didn’t work in some programs. To make the long story short, I tried everything and the solution was to uninstall the driver and use older version. The problem was, Windows 10 kept reinstalling the latest driver!

The solution was this: Install Microsoft tool that “hides” specific driver form Windows so Windows doesn’t “see” it and doesn’t update/reinstall it.

So:

  1. Uninstall or rollback the problematic driver until you have the one that works.
  2. Download this tool:
    Note: I am linking to Microsoft site and not directly to file download so you can be sure that there isn’t some virus or some malware file on the link.
  3. Click Hide Updates, like on photo below.hide updates windows
  4. You will see a list of drivers. Select the driver you want to hide from Windows update and Windows will not update this driver anymore. Click next, wait and that’s it.

If you want Windows to update the driver again, the run this tool again and select “Show hidden updates” and then remove the hidden driver.

Fix Missing Volume Icon in Tray in Windows 10

I’m liking Windows 10 but it has a lot of bugs that make it look like it is still a beta software. One of the most annoying bugs is that the volume icon simply disappears (this usually happens to me when windows 10 wakes up from sleep). Even restarting doesn’t always help. Here is a weird solution I found (which is still just temporary solution but it beats restarting). Going to Notifications & Settings then “Turn system icons on and off” doesnt help because Volume option is greyed out.

This is what helped. When the volume icon goes missing do this:

1. Click on search icon (near start menu) and type “display”.

2. Click “Display settings”

3. Change the size of text to 125% and click apply.

4. Do not log out!

5. Change the text size back to 100% and click apply.

6. Now sign out and then sign back in.

For some weird reason the volume icon is back! Hopefully it works for you too. This (setting text size) might mess up your desktop icon alignment a little but it is not really a problem.

Where are Desktop Viber Avatars located on PC?

If you want to see all the avatars / photos that your Viber contacts use for avatars (even old ones) then you can find big sized images here (this is only for Windows):

DRIVE:\Users\YOUR WINDOWS PROFILE\AppData\Roaming\ViberPC\YOUR PHONE NUMBER\Avatars

so for example if your drive is C, your windwos profiel is FooUser and your phon is 555-55555 then you can find it here:

C:\Users\FooUser\AppData\Roaming\ViberPC\55555555\Avatars

Note: The files might not have standard photo extensions (jpeg,png,.) so might not be able to open them with double clicking on them – but they are still photos. So just drop them into your favorite photo viewer or even better: browse that path with your photo viewer’s explorer.