--- description: meta description tags: ubuntu, ssh --- Allow root ssh login with public key authentication = 1. As root, edit the sshd daemon configuration file (/etc/ssh/sshd_config). 2. Modify the PermitRootLogin and the PubkeyAuthentication parameters to have the following values. ```bash= PermitRootLogin without-password PubkeyAuthentication yes ``` 3. gen host key ```bash= $ ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key $ ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key $ chmod 600 /etc/ssh/ssh_host_dsa_key $ chmod 600 /etc/ssh/ssh_host_rsa_key ``` 4. Restart the sshd daemon. ```bash= $ systemctl restart sshd.service ``` 5. Copy public key into target ```bash= mkdir -p ~/.ssh/ cat << EOF > ~/.ssh/authorized_keys ssh-rsa ... EOF ```
×
Sign in
Email
Password
Forgot password
or
Sign in via Google
Sign in via Facebook
Sign in via X(Twitter)
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
Continue with a different method
New to HackMD?
Sign up
By signing in, you agree to our
terms of service
.