Skip to content

Instantly share code, notes, and snippets.

@tikg
Last active January 20, 2023 07:33
Show Gist options
  • Select an option

  • Save tikg/2378eefb86b9d01b9a0db45cd3124c8f to your computer and use it in GitHub Desktop.

Select an option

Save tikg/2378eefb86b9d01b9a0db45cd3124c8f to your computer and use it in GitHub Desktop.

SSH keygen standard

ssh-keygen -t rsa -b 4096

SSH copy id

ssh-copy-id -i ~/.ssh/mykey user@host

Windows Equivalent of ssh-copy-id on Windows Terminal

type $env:USERPROFILE\.ssh\key.pub | ssh [email protected] "cat >> .ssh/authorized_keys"

Allowing SFTP but disallowing SSH

Subsystem sftp internal-sftp  

And then block other uses:

Match group sftponly  
     ChrootDirectory /upload/%u  
     X11Forwarding no  
     AllowTcpForwarding no  
     AllowAgentForwarding no  
     ForceCommand internal-sftp  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment