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.

  1. -p: Specifies the SSH port of the remote host, default is 22.
  2. – Specify the private key file used for authentication.
  3. -l: Specify the username for remote login.
  4. Enable X11 forwarding to allow graphical applications to be run on a remote host and displayed on the local host.
  5. Enable identity verification agent to allow logging into other hosts via SSH.

Example usage:

  1. Accessing the host remotely: ssh username@hostname.
  2. Specify the port number: ssh -p 2222 username@hostname.
  3. Execute a remote command: ssh username@hostname command
  4. Transfer files to a remote host using the command: scp file username@hostname:destination
  5. 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.

bannerAds