Tag: Windows

  • SSH without password: PuTTY or Git Bash

    SSH without password: PuTTY or Git Bash

    We access remote Linux servers everyday from our Windows computers. Having different servers for different projects, it can be difficult having to enter the passwords over and over in everyday. And so, I suggest that we use SSH Keys instead for authentication to save us some time and boost productivity. SSH keys should also make logins more secure than passwords — just be careful when someone else uses your computer.

    I’ll show you two methods that we can use to connect to our Linux servers using SSH keys and without a password.

    Method 1: PuTTY
    Method 2: Git Bash

    Requirements for this tutorial:

    I personally like using Git Bash to connect via SSH to our server because it’s done in fewer steps than when using PuTTY, but in this tutorial I will first show you password-less connection to SSH via PuTTY.

    Method 1: SSH Connection without password in PuTTY

    1. Download PuTTY from the PuTTY Download Page if you haven’t yet. No installation is required — you just run this .exe file when you need it.
    2. You also need PuTTYgen so if you don’t have it yet, download PuTTYgen from the PuTTY Download Page. This is the PuTTY Key Generator, and will be used to generate a key later. Like putty.exe, no installation is needed for this.
    3. Right click on puttygen.exe then run it.
    4. Make sure that under Parameters, SSH-2 RSA is selected, then click the Generate button. Move your mouse pointer all over the blank area to hasten the key generation.
    5. Copy the generated key, edit the Linux server’s authorized_key file in the .ssh folder (e.g. /home/username/.ssh), and paste the generated key into it. If the .ssh folder or authorized_key  file do not exist yet, create a .ssh folder with permission 700, then create the file authorized_key file with permission 600.
    6. In PuTTY Key Generator, click “Save public key” and save it as a .txt file.
    7. Still in PuTTY Key Generator, click “Save private key” and save it as a .ppk file. It’s recommended for you to save a passphrase for the private key.
    8. Now, run PuTTY. Go to Connection -> SSH -> Auth. Click the browse button to find and select the private key (.ppk file) that you saved in the previous step.
    9. From Connection, go to Session so that you can connect to the Linux server via SSH. Enter the host name or IP address then click Open.
    10. Enter your username.
    11. You should be logged in now without being prompted for password. I think you need to select the .ppk file under Connection -> SSH -> Auth each time you will log in.

    Method 2: SSH Connection without username & password in Git Bash

    1. Install Git on your Windows computer if you haven’t yet. Download Git here. During setup, I didn’t change any setting aside from ticking the “Enable file system caching” checkbox.
    2. If a .ssh folder doesn’t exist yet under C:\Users\<YOUR-WINDOWS-USERNAME>\ then please create it. (I used the browser for Local Site in FileZilla to create .ssh folder)
    3. While inside the .ssh window, right click then choose Git Bash Here.
    4. Run this command: ssh-keygen -t rsa -C "[email protected]", then type the file name for your key (we’ll use this in a config file later), and then type the passphrase that you want to use, twice.
    5. Create a file named config, with no extension name, under the .ssh folder. (FileZilla’s browser for Local Site might help again)
    6. Paste the following into the config file and edit as necessary. <NAME_OF_SSH_KEY> should be the file name you typed earlier after the ssh-keygen command.
    7. Open the .pub key file that you just generated in C:\Users\<YOUR-WINDOWS-USERNAME>\.ssh\ and copy its contents.
    8. Edit the Linux server’s authorized_key file in the .ssh folder (e.g. /home/username/.ssh), and paste the key from the .pub file into it. If the .ssh folder or authorized_key  file do not exist yet, create a .ssh folder with permission 700, then create the file authorized_key with permission 600.
    9. Run Git Bash then enter this command: ssh <LABEL_FOR_CONNECTION> The label for connection should be as set in the config file. If you set a passphrase, you will be prompted for that too.
    10. Just run the same command in Git Bash each time you want to start the connection.

     

    Resources:

    Let me link to the web pages that helped me complete this tutorial:

    HOW TO PASSWORDLESS SSH LOGIN – Server Mom explains how passwordless SSH connections work and will teach you how to implement a Linux to Linux or Windows to Linux connection. This page mostly helped me with Method 1: PuTTY.

    Adding SSH Keys to Authorized_Keys – this page was my reference for chmod settings

    Simplify Your Life With an SSH Config File – helped me complete the Method 2: Git Bash.

  • Log the date & time each time you turn on your Windows computer

    Log the date & time each time you turn on your Windows computer

    In the morning, I sometimes forget the time I log into the time-tracking system in my workplace so I stay a bit longer to make sure I don’t get an “undertime”.

    I thought that my computer at work could help me with this issue somehow. I hoped there was a Windows program that can record the dates and times I turn my computer on. I tried searching for an application like this on Google but couldn’t find any, and wasn’t sure what keywords to search for. (^_^) Someone suggested that I make a Windows Batch File. And so after some web search I came up with this Windows Batch File, which I will later set up to be run each time Window starts.

    This Windows batch file doesn’t tell me exactly what time I came into the office, but it helps, because it logs the date and time I turned my computer on. And turning my computer on is the first thing I do on my office desk. 🙂

    What is a Windows batch file?

    How does this Windows batch file work?

    The Windows batch file is run every time Windows starts, and each time the file is run, it gets the current date and time then saves it into a file. Each time Windows starts, it creates one file with the date and time.

    Like I said, turning my computer on is the first thing I do when I arrive at the office, so the time in the text file written by the program gives me an idea of the approximate time I came in.

    Here’s a preview

    Save files with current date and time with Windows batch file
    Save files with current date and time with Windows batch file
    of the results:

    How to make a batch file that logs current date & time when Windows starts

    Before we begin, please note that I implemented this in a Windows 7 machine.

    Create a folder where you’d like the files to be created. Name it anything you like. I named mine “Time-in” since I’m using the batch file to estimate the time I come into the office.

    Open a text editor such as Notepad.

    Copy the following codes and then paste it into Notepad.

    Save it into the folder you created as “time_in.bat”

    Now, go to that folder and right click on the icon of “time_in.bat” then choose “Create Shortcut”.

    You’ll now see a new file “time_in.bat – shortcut”. Move that shortcut file into your Windows’ startup folder. My Startup folder is in C:\Users\MyUserName\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup so try looking for yours there.

    With what we have done, a file named with current date and time should be created in your folder each time you start Windows.

    Some notes when using this Windows batch file

    You will eventually have a folder with a large number of files because our batch file creates one file per Windows startup. Please find a way to manage those files. You may move older files into an archive folder, or you may delete older files that you no longer need.

    Another note if you’ll use the batch file to track your office time in the morning like I do: the batch file will not create any file if you just hibernate your computer before leaving work instead of shutting down. This is because the “startup” only happens when you start Windows, and this does not happen when you wake your Windows up from hibernation. Possible solution for this may be creating a task in the Task Scheduler of Windows, making the “on wake up” the “trigger” and pointing to the batch file to let it execute. The following settings are what I’ve tried and nothing has worked yet so far… so maybe some of you may come up with a solution that will work. 🙂

    Task scheduler in Windows 7 for the batch file
    Task scheduler in Windows 7 for the batch file
    • Go to Task Scheduler
    • Create Basic Task
    • Fill out name and description
    • Start the task when a specific event is logged
    • Log: System
    • Source: Power-Troubleshooting (or try Kernel-Power with Event ID 42, or try Kernel-General with Event ID 1)
    • Event ID: 1
    • Action: Start a program (then choose program).
    • Finish

    The batch file’s function is good the way it is for me so I didn’t look further into it, but here’s a link to Trigger Task Scheduler in Windows 7 when computer wakes up from sleep/hibernate.

  • How to install Laravel 5 in Windows with XAMPP

    How to install Laravel 5 in Windows with XAMPP

    This short tutorial is based on my own installation of Laravel 5 on XAMPP that is running on Windows 7.

    In this Laravel 5 tutorial, you will need:

    There have been major changes in the following: New Folder Structure, Contracts, Route Cache, Route Middleware, Controller Method Injection, Authentication Scaffolding, Event Objects, Commands / Queueing, Database Queue, Laravel Scheduler, Tinker / Psysh, DotEnv, Laravel Elixir, Laravel Socialite, Flysystem Integration, Form Requests, Simple Controller Request Validation, New Generators, Configuration Cache, Symfony VarDumper.

    To learn more about the Laravel 5.0 update, read about it here.
    (more…)

  • Windows 7 ASUS Issue: Auto-hides taskbar and changes wallpaper to default with Power4Gear Hybrid

    I encountered this issue several times while using an ASUS computer with Power4Gear Hybrid (Windows 7). When I turned the computer on I noticed that my desktop wallpaper was changed into a light gray ASUS wallpaper, and that my taskbar was set to auto-hide. Prior to shutting down, I’m sure my wallpaper was a personalized one and the taskbar was not set to auto-hide.

    Solution to ASUS Power4Gear Hybrid Issue (Taskbar set to auto-hide and wallpaper is changed to default)

    (more…)

  • Windows 7 – if you cannot open Gadgets menu or some Gadgets are hidden

    There was a problem in my Windows 7 desktop a while ago. Supposed to be, there were two Gadgets in there, and I noticed the other is missing. I thought maybe I just accidentally removed it, so I decided to open the Gadgets menu to place it on my Windows 7 desktop again. BUT when I right click and select Gadgets, nothing happens. I tried choosing Gadgets again a few more times, but the Gadgets menu really would not show. I even tried going to Control Panel -> Appearance and Personalization -> Desktop Gadgets, but still, nothing happened.

    I searched Google and found a forum with the solution. It was very simple, actually. (more…)

  • Restore missing desktop icons in Windows XP or Windows 7

    I noticed that all my desktop icons were gone. I thought it was only because my computer was hanging, so I restarted it. After the restart there were still no icons. I’m not the kind of computer user who knows every solution to every small problem so I searched for solutions to what happened. (And I’m posting this in case a visitor needs help with the same thing.)

    First thing I tried, based on a how-to page I stumbled upon (for Windows 7), was I right-click on my desktop and chooe Personalize. From the left side of the window that opened, I clicked on the “Change desktop icons.” There I checked the icons I wanted to appear. After clicking OK, there were still no icons.

    I did a bit more of searching and then (more…)