SSH, or Secure Shell, is a protocol used to securely log onto remote systems. It is the most common way to access remote Linux and Unix-like servers. It is the most common way to access remote Linux and Unix-like servers. Secure Shell (SSH) is a cryptographic network protocol for operating network services securely over an unsecured network. Typical applications include remote command-line login and remote command execution, but any network service can be secured with SSH.
- Quick Introduction to
ssh
for Mac Admins (this post)
Please consider supporting Scripting OS X by buying one of my books!
What is SSH?
SSH is short for ‘Secure SHell’. It is a protocol that allows you to open a shell (terminal session) on another remote computer over the network. On macOS you will usually initiate an SSH session with the Terminal application, though there are other third party applications for macOS and iOS that support the SSH protocol as well.
On macOS SSH access is sometimes called ‘Remote Login’.
As the name implies, connections over SSH are encrypted and secure. This may not seem unusual today, but it did replace many unsecured protocols such as
telnet
and rlogin
.SSH is supported on many platforms. You can use SSH to connect to Macs as well as any other computer which supports SSH and has it enabled. Of course, when you SSH to a different system, the environment you get through SSH might be very different (i.e. not
bash
, different commands, etc.), so be sure you understand the remote system.Enable SSH access
By default SSH access is disabled on macOS. Before you can connect to a Mac with SSH you need to enable access. In the UI you can do this in System Preferences > Sharing, by enabling the ‘Remote Login’ option. Here you can also control whether all users on the Mac can get SSH access or just some of them.
The Sharing pane will also show the current hostname of this computer:
You can also enable SSH access from the command line with
and turn it off again with
Turning SSH off with this command helpfully reminds you that if you are currently connected remotely, you will disconnect with this command and have to login locally to re-enable. To override this helpful notice, you can add the
-f
option:And if you want to know which hostname a Mac thinks it is, use the
hostname
command:Note: If you want to control which users have access with a script, I have an example in this post. This post was written for Munki but should be fairly easy to adapt to other systems.
Connect with SSH
To connect to a machine from another Mac (the one you are working on) is simple enough. Open Terminal and enter:
or alternatively (different syntax, same result, which one you prefer is a matter of taste)
If you do not give a
username
, ssh
will use the short name you are currently logged in as. That is a useful shortcut if the username is the same on both systems.When you connect to a remote machine for the first time you will get this prompt:
(Your actual fingerprint will look differently.) This prompt tells you that your
ssh
does not recognize this host and gives you a chance to not connect. For now, type yes
to confirm. This will add the host to the list of known hosts, so the prompt will not return when you connect again. We will discuss keys and security in a later post.Next
ssh
will prompt you for the password on the remote computer. Once you enter that you will get the prompt and have a secure shell to the remote computer. Any command you enter now, will be run on the remote computer.You can connect with
ssh
when no user is logged in, i.e. the Mac is sitting at the login window. You can even connect with one user, while a different user is logged into the Mac with a UI session. In these cases, commands that interact with the UI, will fail, since the UI is either not running, or running as a different user. Most common examples are open
and osascript
(AppleScript).If you happen to be logged in on the same Mac with the same user, then the command will work, but
open
will open and display the Finder window on the remote Mac, not the Mac you are working on, which can be confusing.Ending it
To end the remote session, just use the
exit
command.This will return you to the shell on your Mac where you executed the
ssh
command.SSH Shortcut Files
If you frequently connect to certain hosts you may want to create an ssh short cut file, which you can then just double click or invoke with spotlight.
Execute Just One Command
Instead of opening a remote shell you can use
ssh
to just execute just a single command on the remote host:The
ssh
command will prompt for the password and the print the output of the command from the remote machine. This can be very useful. You can combine multiple commands with ;
In some case the command you want to execute remotely can prompt for information, usually a password. You can add the
-t
option to make ssh
use an interactive shell:![Best Best](/uploads/1/3/3/8/133848526/658792272.png)
This will prompt twice for the password. The first time to establish the remote connection and the second time for
sudo
on the remote machine.Sending single commands with
ssh
can be useful for automating workflows in scripts. However, the requirement to keep entering passwords will be very detrimental to automation. It will also be annoying when you frequently connect to specific remote Macs.We will discuss how the key security works and how it can replace passwords in the following posts.
Our SSH client supports all desktop and server versions of Windows, 32-bit and 64-bit, from Windows XP SP3 and Windows Server 2003, up to the most recent – Windows 10 and Windows Server 2019.
Our client is free for use of all types, including in organizations. To begin, simply download it here.
Our SSH and SFTP client for Windows incorporates:
- One of the most advanced graphical SFTP clients.
- Single-click Remote Desktop forwarding.
- State-of-the-art terminal emulation with support for the bvterm, xterm, and vt100 protocols.
- Support for corporation-wide single sign-on using SSPI (GSSAPI) Kerberos 5 and NTLM user authentication, as well as Kerberos 5 host authentication.
- Support for ECDSA, RSA and DSA public key authentication with comprehensive user keypair management. https://pleasetree.weebly.com/email-client-for-mac-gmail.html.
- Encryption and security: Provides state-of-the-art encryption and security measures suitable as part of a standards-compliant solution meeting the requirements of PCI, HIPAA, or FIPS 140-2 validation.
- Obfuscated SSH with an optional keyword. When supported and enabled in both the client and server, obfuscation makes it more difficult for an observer to detect that the protocol being used is SSH. (Protocol; OpenSSH patches)
- Powerful SSH port forwarding capabilities, including dynamic forwarding through integrated SOCKS and HTTP CONNECT proxy.
- Powerful command-line parameters which make the SSH client highly customizable and suitable for use in specific situations and controlled environments.
- An FTP-to-SFTP bridge allowing you to connect to an SFTP server using legacy FTP applications.
- An advanced, scriptable command-line SFTP client, sftpc.
- A scriptable command-line remote execution client, sexec, and a command-line terminal console client, stermc.
- A scriptable command-line tunneling client, stnlc, with support for static port forwarding rules, dynamic SOCKS-based tunneling, and FTP-to-SFTP bridge.
- Our .NET SSH library, FlowSshNet, with example PowerShell scripts showing how to use the SSH library for file transfer and remote program execution from PowerShell.
- Bitvise SSH Server remote administration features.
Bitvise software does not contain ads, install product bundles or collect user data for sale. We are 100% supported by users who license our software. Thank you!
Bitvise SSH Client incorporates one of the most advanced SFTP file transfer clients, supporting:
- automatic resuming, text file awareness, recursive subdirectory transfers;
- powerful, advanced transfer list management;
- verified-integrity resume with servers that support SFTP v6 check-file and check-file-blocks;
- high speed - in tens or hundreds of MB/s with Bitvise SSH Server, network and disk speed permitting;
- fast responsiveness to user input even when in the middle of multiple file transfers.
Bitvise SSH Client also incorporates an advanced, scriptable command-line SFTP client.
Bitvise SSH Client provides integrated access to the SSH server's console, either via VT-100 and xterm protocols supported by most SSH servers on any platform, or via the enhanced bvterm protocol supported by Bitvise SSH Server:
- all terminal emulation is done in a regular Windows console, using standard Windows fonts, supporting standard settings for Windows consoles;
- UTF support with VT-100 and xterm, Unicode support with bvterm (full Unicode support on NT-series Windows platforms);
- full color support with xterm and bvterm;
- support for large screen buffers, all key combinations including Alt-keys and accurate console rendering with bvterm (fully accurate on NT-series Windows platforms).
Bitvise SSH Client also incorporates a command line terminal emulation client, stermc, as well as a command-line remote execution client (sexec).
When using Bitvise SSH Client to connect to a GSSAPI-enabled SSH server in the same or a trusted Windows domain, you can let Kerberos 5 (or on older platforms, NTLM) perform the server as well as user authentication for you. No manual host key verification; no management of user passwords and public keys. Just tell the SSH client which server in the domain to connect to, and if that server is Bitvise SSH Server (WinSSHD) or another server with compatible support for GSSAPI, the two programs will authenticate and establish a secure connection automatically.
Bitvise SSH Client is a powerful SSH2 port forwarding client with many features, including:
- Dynamic tunneling via integrated proxy supporting SOCKS4, SOCKS4A, SOCKS5 and HTTP CONNECT proxy tunneling protocols. Configure your applications to connect to target hosts through the SSH Client's proxy, and no manual tunneling rules need be configured.How to set up programs for dynamic tunneling: Firefox, IE; with these settings in Bitvise SSH Client.
- Port forwarding settings can be saved to and loaded from a profile. One can maintain multiple complex tunneling configurations without having to manually enter parameters before each session.
- Bitvise SSH Client minimizes its presence by displaying only a system tray icon when running in the background. If an error is encountered while the program is minimized, the icon reflects that.
- Server-side forwarding: with Bitvise SSH Server and Client, a server and multiple clients can be set up so that all port forwarding rules are configured centrally at the server, without requiring any client-side setting updates. The SSH clients only need to be configured once, and port forwarding rules can easily be changed when necessary.
- Command-line parameters are supported. Using command-line automation, a port forwarding session can be started from a link in the Startup menu without requiring any user interaction whatsoever. Help with the command-line parameters can be found in the SSH client log area when it is first started, or by executing 'BvSsh /?' from a command prompt.
- After an SSH session is established, any external application can be launched automatically.
- If an SSH session is interrupted, Bitvise SSH Client can automatically reconnect to the server.
Fortinet ssl vpn client for mac. Bitvise SSH Client also incorporates an advanced, scriptable command-line tunneling client.
Run 'BvSsh -?' for a list of command-line parameters providing flexibility to:
- make Bitvise SSH Client load a profile and connect immediately on startup and exit on disconnect using the -profile, -loginOnStartup and -exitOnLogout parameters;
- make Bitvise SSH Client hide portions of its user interface (main window, authentication messages, access to SSH features) using the -hide and -menu parameters;
- run Bitvise SSH Client from removable media and prevent it from making any changes to the Windows registry - and yet use public key authentication and verify host keys using the -noRegistry, -keypairFile and -hostKeyFile parameters;
and more.
Additionally, when the graphical Bitvise SSH Client is running, you can use the command line utility BvSshCtrl to programmatically cause the client to log in, log out, or exit. Run 'BvSshCtrl' for help.
Bitvise SSH Client (Tunnelier) supports command-line parameters that control how it uses the Windows registry (the -noRegistry and -baseRegistry parameters). This can be used when control over registry usage is required.
The latest versions of our SSH Client additionally support storing host key information and client authentication keypairs in an SSH Client profile. This means that you can copy the contents of the SSH Client installation directory to a USB key, insert the USB key into another computer, and run the graphical SSH Client as follows:
BvSsh -noRegistry -profile=U:Profile.bscp
This will tell the Client to not use the Windows registry, and to connect exclusively using the host and keypair information you have saved into Profile.bscp.
Ssh For Mac
For more information about the supported command line parameters, run the graphical SSH Client as follows:
BvSsh -?
Bitvise SSH Client further includes command line clients – sftpc, sexec, stermc, and stnlc – which also support the -noRegistry and -profile parameters. These command line clients are frequently used unattended, but can also be used interactively. For more information, check Using Bitvise SSH Client Unattended.
Bitvise SSH Client incorporates sftpc, an advanced command-line SFTP client which supports:
- queued background transfers so you can continue browsing directories while a file downloads ('get * -bg');
- powerful command-line parameters for automated scripted transfers launched from a batch file or an external program;
- verified-integrity resume with servers that support SFTP v6 check-file and check-file-blocks;
- automatic text file conversion when transferring files between platforms (the 'type' command);
- wildcards - the * and ? wildcard characters can match more than one file;
- recursive transfers - a simple 'get * -s' downloads all files and subdirectories;
- resume support - 'get file.txt -r' resumes a previously downloaded file if it already exists;
- high speed - in the tens of MB/s with Bitvise SSH Server, network and disk speed permitting.
Additional information:
- Usage: after installing Bitvise SSH Client, get this help by executing 'sftpc -?'
- Command list: after installing Bitvise SSH Client, get this help by connecting to a server using sftpc, then execute 'help' and 'help <command>'
- The 'log' utility can be used with sftpc to store the output of each individual SFTP session in a separate, uniquely named log file for auditing.
- The 'retry' utility can be used with sftpc to automatically repeat transfer attempts after specific types of failures.
Bitvise SSH Client incorporates sexec, a scriptable command-line remote execution client which can be used to securely execute programs on remote machines from a batch file. The batch file can perform actions based on the exit code reported from the remote program, and can capture the remote program's output for processing by simple redirection of sexec output.
Another command-line program included with Bitvise SSH Client, stermc, conveniently opens an SSH terminal emulation session with xterm, VT-100 and bvterm support in the same Command Prompt window it is started from. If you SSH from computer A to computer B running Bitvise SSH Server, and you also have Bitvise SSH Client installed on computer B, you can use stermc to conveniently establish an onward SSH terminal session to computer C.
All Bitvise command-line clients support all authentication methods supported by Bitvise SSH Client, can load settings from a profile configured in the graphical client, work with the same user keypair and host key database as the graphical client, can connect through a SOCKS or HTTP CONNECT proxy, and support a common set of command-line parameters controlling most aspects of establishing an SSH connection.
Bitvise SSH Client incorporates stnlc, a scriptable command line port forwarding client with support for static port forwarding rules, dynamic SOCKS-based tunneling, as well as the FTP-to-SFTP bridge.
For more information about using this client, run 'stnlc -h'.
Bitvise SSH Client incorporates an FTP-to-SFTP bridge which performs translation between the FTP and SFTP protocols, allowing any FTP client application to connect securely to an SFTP server through Bitvise SSH Client. Both active mode and passive mode FTP data connections are supported, as well as restarted transfers, directory listings and other features. All FTP clients should be able to list directories and transfer files across Bitvise SSH Client's FTP-to-SFTP bridge, including integrated clients in applications such as DreamWeaver, GUI clients such as BulletProof FTP, and command line clients such as the default ftp.exe client accompanying Windows. If an FTP client you use fails to work with Bitvise SSH Client's FTP-to-SFTP bridge, let us know.
See Accessing an SFTP Server with an FTP Client for more information about the FTP bridge.
![Shell Shell](/uploads/1/3/3/8/133848526/207679205.png)
When connected to Bitvise SSH Server, our client can do all of the above, as well as the following:
- bvterm console: when connected to Bitvise SSH Server, our client provides you with the best console available on the Windows platform. Our bvterm protocol supports the full spectrum of a Windows console's features: colors, Unicode characters, all-key access and large scrollable buffers.
- remote server configuration: using Bitvise SSH Client, all SSH server settings can be configured remotely as if you were sitting in front of the server itself.
SSH and SFTP:
- Key exchange algorithms:
- Curve25519
- ECDH over elliptic curves secp256k1, nistp256, nistp384, nistp521 using SHA-512, SHA-384, or SHA-256
- Diffie Hellman with group exchange using SHA-256 or SHA-1
- Diffie Hellman with fixed 4096, 3072, 2048, or 1024-bit group parameters using SHA-512, SHA-256, or SHA-1
- GSSAPI key exchange using Diffie Hellman and Kerberos authentication
- Signature algorithms:
- Ed25519
- ECDSA over elliptic curves secp256k1, nistp256, nistp384, nistp521 using SHA-512, SHA-384, or SHA-256
- RSA using 4096, 3072, 2048, 1024-bit key sizes with SHA-512, SHA-256, or SHA-1
- DSA using SHA-1 (legacy)
- Encryption algorithms:
- AES with 256, 128-bit keys in GCM mode
- AES with 256, 192, 128-bit keys in CTR mode
- AES with 256, 192, 128-bit keys in CBC mode (legacy)
- 3DES in CTR or CBC mode (legacy)
- Data integrity protection:
- AES with 256, 128-bit keys in GCM mode
- HMAC using SHA-256, SHA-1
- Server authentication:
- Client verifies server identity using server host key fingerprint or public key
- Automatic synchronization of new host keys to client supported
- Client authentication:
- Password authentication with Windows accounts - local or Active Directory
- Password authentication with virtual accounts - configurable password policy
- Public key authentication
- Kerberos single sign-on using GSSAPI
- Two-factor authentication with a time-based one-time password
Remote Shell Ssh Client For Mac Os X
When FIPS is enabled in Windows, our software uses Windows built-in cryptography, validated by NIST to FIPS 140-2 under certificates #2937, #2606, #2357, and #1892. On Windows XP and 2003, our software uses the Crypto++ 5.3.0 FIPS DLL, originally validated by NIST under certificate #819 (historical). When FIPS mode is not enabled, additional non-FIPS algorithms are supported.