Skip to content

Instantly share code, notes, and snippets.

View ZilchBloke's full-sized avatar
🎯
Focusing

ZilchBloke

🎯
Focusing
View GitHub Profile

ssh-agent

For Windows:
Use Powershell (7.3 and above as an admin).
By default the ssh-agent service is disabled.
Configure it to start automatically.
Get-Service ssh-agent | Set-Service -StartupType Automatic
Start the service
Start-Service ssh-agent

>For Linux:

@ZilchBloke
ZilchBloke / sshInWin.md
Last active June 26, 2024 07:39
SSH in windows and Powershell

SSH : Secure Shell is a cryptographic network protocol.
SSH protocol Architecture:
Two computers in secure shell communicate where one of them is client and the other is server.
And SSH provides cryptographic sheild to this communication.
client presents query
server responds to query

SSH in Windows - FULL [NO BS!]

Use Powershell 7.3 or up. as an Administrator.

To check the state of ssh package:

Get-WindowsCapability -Online -Name OpenSSH*

@ZilchBloke
ZilchBloke / rootPasswd.md
Last active April 17, 2023 08:20
Change root password from Grub (RHEL 9 or CentOS9 specific)

Changing root password from GRUB (without using existing password)

For RHEL9

Steps

  1. When the machine starts, after bios loads up, Grub menu appears (with 2 options for boot kernel)
    Use the arrow key to highlight the rescue kernel (Out of 2 options one will specify to be ..rescue.. kernel) and press e
  2. Use the arrow key to mve the crusor to the end of the line starting with linux..
  3. At the end of the line, append rd.break and press Ctrl+x
  4. mount -o remount,rw /sysroot/ to allow read and write permission to /sysroot/
  5. chroot /sysroot/
  6. passwd to change the password. Shell will prompt to type the new password and retype it to avoid typo.
@ZilchBloke
ZilchBloke / ssh-keygen-ed25519.md
Last active April 18, 2023 00:05
ssh-keygen with ed25519 encryption

ssh-keygen with ed25519 encryption

Generate ed25519 keys for ssh in ~/.ssh/ default-directory with identifying filename and comment.

ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/server_key -C "ServerUsername@ServerHostname"

For windows :

ssh-keygen -o -a 100 -t ed25519 -f $env:USERPROFILE\.ssh\server_key -C "ServerUsername@ServerHostname"

ssh-keygen will create 2 keys file. Public Keys(with .pub) and Private Keys. |Options|Meaning|

@ZilchBloke
ZilchBloke / ssh-copy-id.md
Last active April 18, 2023 00:07
ssh-copy-id for powershell. (Windows Client to Linux Server)

ssh-copy-id for powershell. (Windows Client to Linux Server)

execute the command as an Administrator.
cat $env:USERPROFILE\.ssh\KeyToServer.pub | ssh "mkdir ~/.ssh/ ; touch ~/.ssh/authorized_keys ; cat >> ~/.ssh/authorized_keys"

@ZilchBloke
ZilchBloke / sshKeygenCopyID.md
Last active April 18, 2023 00:19
ssh-keygen (ed25519) and ssh-copy-id for powershell. (windows client to linux server)

One Line ssh-keygen (ed25519) and ssh-copy-id for powershell. (windows client to linux server)

ssh-keygen -o -a 100 -t ed25519 -f $env:USERPROFILE\.ssh\server_key -C "ServerUsername@ServerHostname" && cat $env:USERPROFILE\.ssh\server_key.pub | ssh linuxUser@linuxServer "mkdir ~/.ssh/ ; touch ~/.ssh/authorized_keys ; cat >> ~/.ssh/authorized_keys"

Fill the above command with relatable entry for you

Variables Description
server_key.pub Filename of your public key. Located in $env:USERPROFILE\.ssh\ . It could be id_ed25519.pub or id_rsa.pub or whatever. In this case it is server_key.pub
`-C "ServerUsername@ServerHostname" '-C' is comment option and comment are written between " ", to relate the key to the server.
linuxUser User of the server(linux machine)[in this case, linuxServer],with which we are using ssh to connect to the server.
@ZilchBloke
ZilchBloke / hyperV.bat
Last active March 21, 2023 01:54
Enable Hyper-v on windows 10 Home edition
pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt
for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
del hyper-v.txt
Dism /online /enable-feature /featurename:Microsoft-Hyper-V -All /LimitAccess /ALL
pause