The ssh command in Linux is used to establish a secure shell (SSH) connection to a remote server or device. It allows you to log in to a remote system securely and execute commands as if you were sitting at the remote machine's terminal. Here's the basic syntax of the ssh command:
ssh [options] [user@]hostname [command]
Here are a few examples of how you might use the ssh command:
ssh username@hostname
SSH connection with a specific port and private key:
ssh -p 2222 -i ~/.ssh/my_private_key username@hostname
SSH connection with X11 forwarding (for graphical applications):
ssh -X username@hostname
SSH tunneling for remote access to a local service (example: accessing a web server running on port 8080 locally):
ssh -L 8080:localhost:8080 username@hostname
Running a specific command on the remote server:
ssh username@hostname "ls -l /path/to/directory"
Remember to replace username, hostname, and any paths with your specific information. Also, keep in mind that SSH access to remote systems requires proper authentication and permissions.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.