Last active
December 13, 2018 09:38
-
-
Save jpzhu/1a3ff03d7a4aaeb579dab45917d20692 to your computer and use it in GitHub Desktop.
sshd root ssh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 禁止密码登录 | |
PasswordAuthentication no | |
# 禁止Root登录 | |
PermitRootLogin no | |
# 网开一面 | |
Match Address 172.xx.yy.zz | |
PermitRootLogin yes | |
# 重启sshd服务 | |
service sshd restart | |
#禁用某个账号登录 | |
# 在~/.ssh/authorized_keys 可以增加command执行ssh后的操作 | |
no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo 'Please login as the user \"ec2-user\" rather than the user \"root\".';echo;sleep 10" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAoXbOTG1wKV/+BKYd yiba-aws | |
# 启动端口转发 | |
GatewayPorts yes | |
/eth/ssh/ssh_config 客户端配置和服务器长连接。
TCPKeepAlive yes
ServerAliveInterval 30
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ssh出现permission denied (publickey)问题:
修改/etc/ssh/sshd-config文件.
将其中的PermitRootLogin no修改为yes
PubkeyAuthentication yes修改为no
AuthorizedKeysFile .ssh/authorized_keys前面加上#屏蔽掉,
PasswordAuthentication no修改为yes就可以了。
利用私钥恢复公钥
ssh-keygen -y -f private.pem