![]() ![]() Or perhaps you need to pull a file from the remote system. You could try something like this: $ ssh "cat /var/log/secure" | grep -i fail ![]() Maybe you need to check a log file on a remote server for "fail" messages. The command executes, and the connection is closed.įor example, you could check the installation status of a package: $ ssh "rpm -qa | grep nano" SSH allows users to append the desired command directly to the connection attempt. Recall that you are challenged for a password in these examples unless you have key-based authentication configured (you probably should, but it's out of scope for this article). What if the only thing you need to do over the SSH connection is execute a single quick command? You might not want to take the separate actions of connecting and authenticating, running the command, and then disconnecting. The interactive session is established, and you may now conduct your administrative tasks. On some systems, security configurations prevent the root user from connecting over SSH, so it may be necessary to elevate privileges at this point. Once authenticated, the remote system presents a command prompt and provides the ability to run commands or access resources with whatever privileges the connecting user has. This is the password for the specified user account on the remote system. This command initiates SSH and specifies the user account the remote server should authenticate and the destination server's identity (hostname or IP address): $ ssh connection attempt triggers a password challenge. I'll begin with what might be considered a standard SSH connection. Read Passwordless SSH using public-private key pairs for guidance on this critical configuration or Eight ways to protect SSH access on your system for general suggestions. Key-based authentication connection attempts are quicker, easier to automate, and considered to be more secure. In these exercises, key-based authentication is NOT configured, so SSH prompts you for a password.įor the record, key-based authentication is highly recommended (indeed, almost assumed at this point).You're using the standard 22/tcp SSH port.The firewall configuration permits SSH.An SSH client is installed on the local computer.The SSH service is installed and running on the destination server.I've made a few assumptions about your setup: There are plenty of SSH configuration articles, so this article is about using SSH rather than configuring it. The main focus is to provide guidance for running one-off commands over an SSH connection and how to tunnel other applications, and I've added a bonus section on using scp to securely copy files. This article provides a quick review of standard SSH use. How well do you know Linux? Take a quiz and get a badge.Linux system administration skills assessment.A guide to installing applications on Linux.Download RHEL 9 at no charge through the Red Hat Developer program. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |