Skip to content

Instantly share code, notes, and snippets.

@Alexnder
Last active September 16, 2017 22:21
Show Gist options
  • Save Alexnder/e225e8c3c725fdfa7a20 to your computer and use it in GitHub Desktop.
Save Alexnder/e225e8c3c725fdfa7a20 to your computer and use it in GitHub Desktop.
ssh config remote private key access

Create keys

cd ~/.ssh/
ssh-keygen -t rsa
cp id_rsa.pub authorized_keys
chmod 700 .
chmod -R 600 ./*

If Server refused our key:

chmod go-w ~/

If fatal: no matching cipher found: Add to /etc/ssh/sshd_config

Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,blowfish-cbc,aes128-cbc,3des-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc

Map port from site.com:80 to localhost:8080

ssh -L 8080:localhost:80 root@site.com -i D:\key.pem

config

Host github.com
  User git
	Hostname github.com
	PreferredAuthentications publickey
	IdentityFile ~/.ssh/id_rsa

looking for error: /var/log/auth.log

In case of empty file:

/etc/init.d/rsyslog restart

chroot

Match group sftp
     ChrootDirectory /sftpdir
     X11Forwarding no
     AllowTcpForwarding no
     ForceCommand internal-sftp

/sftpdir - must be own by root and has access to write only for root

add & fulfill group

groupadd sftp
usermod -a -G sftp user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment