SSH Connection mode
Ssh-p [email protected] # from Linux SSH login to another linux ssh-p [email protected] CMD # using SSH to operate the remote host scp-p 22 file [email protected]:/directory # Copy the local file to the remote host Sshpass -P ' password ' ssh-n [email protected] $IP "echo Hello" # Specify password remote operation Ssh-o Stricthostkeychecking=no $IP # SSH connection does not prompt yesssh-t "Su-" # Specify pseudo Terminal client to work in interactive mode SCP [email protected]: Remote directory Local Directory # Copy the remote specified file to the local ssh-n-l2001:remotehost:80 [email protected] # Create a port forwarding channel with SSH ssh-t host_a SSH host_b # nested using Sshssh-t-P [email protected] $Ip/bin/su-root-c {$CMD}; # remote SU execution command cmd= "\"/sbin/ifconfig eth0\ "" ssh-keygen-t RSA # Generate key Ssh-copy-id -I [email protected] # transfer Keyvi $HOME/.ssh/authorized_keys # Public key storage location SSHFS [email protected]:/path/to/folder/path/to/mount/point # mount the folder on the remote host via SSH fusermount-u/path/to/mount/point # Uninstall the SSH mount Directory ssh [email protected] cat/path/to/remotefile | Diff/path/to/localfile-# Use diff to compare remote files with local files su-user-c "ssh [email protected] \" Echo-e AA |mail-s Test [email protected]\ "" # Toggle user logon remote Send mail
SSH Reverse Connection
# External Network A to control the intranet BSSH-NFR 1234:localhost:2223 [email protected]-p22
# Bind the 1234 port of host A to the 2223 port of Host B, which is equivalent to the remote port mapping
Ss-ant # At this time on a host sshd will LISTEN local 1234 Port # LISTEN 0 127.0.0.1:1234 *:*
SSH localhost-p1234
# on a host connection local 1234 port
LINUX-SSH Connectivity Issues