-
Notifications
You must be signed in to change notification settings - Fork 0
ssh_usage
[[TOC]]
SSH uses direct TTY access to ensure that the password is indeed issued by an interactive keyboard use.
ssh access into the remote device:
ssh <username>@<hostname/ip address>
runs SSH in a dedicated TTY, fooling SSH into thinking it is getting the password from an interactive user.
three way for sshpass access into remote device:
-
provides password from argument
sshpass -p <password> ssh <username>@<hostname/ip>
-
provides password from the 1st line of file
sshpass -f <file> ssh <username>@<hostname/ip>
-
provides passrd from environment value
sshpass -e ssh <username>@<hostname/ip>
more reference: sshpass usage
securely copy a file into the remote device root path (default path):
scp <file> scp:<username>@<hostname/ip address>/<remote path>
securely copy a file from remote device:
scp scp:<username>@<hostname/ip address>/<remote path>/<file> <local file>
securely copy file between remote device
-
connect to remote device
sftp <username>@<hostname/ip address>/<remote path>
-
indicates
sftp >
, connected with remote device-
send file to remote device
put <file>
-
receive file from remote device
get <file>
-
Run command on remote device
ssh <username>@<hostname/ip_address>/<remote_path> '<command>'
copying the local host’s public key to the remote host’s authorized keys file and by verifying file permissions and ownership
ssh-copy-id -i <public key> <username>@<hostname/ip address>