TOOL » LINUX » SSH
Server
Disable password
Edit /etc/ssh/sshd_confg:
ssh-config
PasswordAuthentication noLocal network only SFTP
For better security:
- Disable any kind of authentication by default
- Enable
PubkeyAuthenticationfor local connections only - Disable shell by:
- Enabling sftp-only access with
SubsystemForceCommand - Changing
ChrootDirectory
- Enabling sftp-only access with
Create a file /etc/ssh/sshd_config.d/10-local-sftp.conf with:
ssh-config
# Security
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication no
AllowTcpForwarding no
## SFTP only
Subsystem sftp internal-sftp
Match LocalAddress 192.168.0.*
AllowUsers mateus
PubkeyAuthentication yes
AuthenticationMethods publickey
ForceCommand internal-sftp
ChrootDirectory /homeINFO
Directory set in ChrootDirectory must be owned by root. For more info see SFTP chroot.