Remote access to Ubuntu machine via ssh. Commands.
Task List:
Check that any SSH services are installed on the remote Linux machine
1
dpkg -l | grep sshCheck for the correct cervice name
Run the following command to list all available services related to SSH:1
systemctl list-units --type=service | grep sshYou might see service names like:
- ssh.service
- sshd.service
- openssh-server.service
Check that
openssh-serveris installed1
sudo apt-get install openssh-serverVerify the installed
openssh-serverconfiguration1
sudo systemctl status sshdCheck secure SSH access via the configuration file
1
sudo nano /etc/ssh/sshd_configConfirm that
openssh-serveris running1
sudo systemctl start sshd && sudo systemctl enable sshdTest SSH connection from a remote system
1
ssh username@<remote_machine_ip>Transfer files using SSH from
<local_machine>to<remote_machine>1
scp /path/to/local/file username@<remote_machine_ip>:/path/to/remote/destination
Additional Commands:
Restart the SSH service after making configuration changes
1
sudo systemctl restart sshdCheck the active SSH sessions on the remote machine
1
who | grep sshAllow only key-based authentication for SSH connections
1
2
3
4sudo nano /etc/ssh/sshd_config
# Change the following:
# PasswordAuthentication no
# PermitRootLogin noMonitor SSH access logs
1
sudo tail -f /var/log/auth.logPut the syste to suspend, by
power management(aliaspm):1
sudo pm-suspendPut the syste to suspend by
systemctl:1
sudo systemctl suspend