Ubuntu SSH命令行使用技巧包括:
sudo apt update && sudo apt install openssh-server。sudo systemctl start ssh 和 sudo systemctl status ssh。/etc/ssh/sshd_config 文件,例如添加 Port 2222 然后重启SSH服务:sudo systemctl restart ssh。ssh username@ip_address。ssh -p port_number username@ip_address。ssh-keygen -t rsa,上传公钥到远程服务器:ssh-copy-id username@ip_address。使用 scp 进行安全的文件传输:
scp /path/to/local/file username@ip_address:/path/to/remote/destination。scp username@ip_address:/path/to/remote/file /path/to/local/destination。断开SSH连接:exit。
/etc/ssh/sshd_config 中设置 PermitRootLogin no。PubkeyAuthentication yes 和 PasswordAuthentication no。ufw 允许SSH流量:sudo ufw allow ssh。sudo systemctl status ssh。通过以上技巧,可以更高效和安全地使用Ubuntu的SSH命令行功能。