What is the usage of the Linux ssh command?
The ssh command is used for remotely logging into a Linux server or other remote host. It allows users to securely execute commands or transfer files on the local host.
The basic syntax is as follows:
ssh [选项] [用户名@]主机名 [命令]
I can’t make it to the meeting today.
- -p: Specifies the SSH port of the remote host, default is 22.
- – Specify the private key file used for authentication.
- -l: Specify the username for remote login.
- Enable X11 forwarding to allow graphical applications to be run on a remote host and displayed on the local host.
- Enable identity verification agent to allow logging into other hosts via SSH.
Example usage:
- Accessing the host remotely: ssh username@hostname.
- Specify the port number: ssh -p 2222 username@hostname.
- Execute a remote command: ssh username@hostname command
- Transfer files to a remote host using the command: scp file username@hostname:destination
- Download a file from a remote host: scp username@hostname:file destination.
Please make sure that the SSH server is enabled on the remote host and that the local host can access the remote host when using the ssh command.