### Home Classes Methods

### In Files

- lib/chef/knife/ssh.rb

### Parent

Chef::Knife

### Methods

- #configure_attribute
- #configure_gateway
- #configure_identity_file
- #configure_session
- #configure_user
- #cssh
- #extract_nested_value
- #fixup_sudo
- #get_password
- #get_stripped_unfrozen_value
- #interactive
- #macterm
- #print_data
- #prompt_for_password
- #read_line
- #reader
- #run
- #screen
- #session
- #session_from_list
- #ssh_command
- #tmux

### Included Modules

- Chef::Mixin::ShellOut

### Files

- LICENSE

### Class/Module Index

Quicksearch

- Chef
- Chef::ApiClient
- Chef::ApiClient::Registration
- Chef::Application
- Chef::Application::Apply
- Chef::Application::Client
- Chef::Application::Knife
- Chef::Application::Solo
- Chef::Application::Wakeup
- Chef::Application::WindowsService
- Chef::Checksum
- Chef::Checksum::Storage
- Chef::Checksum::Storage::Filesystem
- Chef::ChefFS
- Chef::ChefFS::CommandLine
- Chef::ChefFS::FilePattern
- Chef::ChefFS::FileSystem
- Chef::ChefFS::FileSystem::BaseFSDir
- Chef::ChefFS::FileSystem::BaseFSObject
- Chef::ChefFS::FileSystem::ChefRepositoryFileSystemEntry
- Chef::ChefFS::FileSystem::ChefRepositoryFileSystemRootDir
- Chef::ChefFS::FileSystem::ChefServerRootDir
- Chef::ChefFS::FileSystem::CookbookDir
- Chef::ChefFS::FileSystem::CookbookFile
- Chef::ChefFS::FileSystem::CookbookSubdir
- Chef::ChefFS::FileSystem::CookbooksDir
- Chef::ChefFS::FileSystem::DataBagDir
- Chef::ChefFS::FileSystem::DataBagItem
- Chef::ChefFS::FileSystem::DataBagsDir
- Chef::ChefFS::FileSystem::FileSystemEntry
- Chef::ChefFS::FileSystem::FileSystemError
- Chef::ChefFS::FileSystem::FileSystemRootDir
- Chef::ChefFS::FileSystem::MustDeleteRecursivelyError
- Chef::ChefFS::FileSystem::NodesDir
- Chef::ChefFS::FileSystem::NonexistentFSObject
- Chef::ChefFS::FileSystem::NotFoundError
- Chef::ChefFS::FileSystem::RestListDir
- Chef::ChefFS::FileSystem::RestListEntry
- Chef::ChefFS::Knife
- Chef::ChefFS::PathUtils
- Chef::Client
- Chef::Config
- Chef::Cookbook
- Chef::Cookbook::Chefignore
- Chef::Cookbook::CookbookVersionLoader
- Chef::Cookbook::FileSystemFileVendor
- Chef::Cookbook::FileVendor
- Chef::Cookbook::Metadata
- Chef::Cookbook::MinimalMetadata
- Chef::Cookbook::RemoteFileVendor
- Chef::Cookbook::SyntaxCheck
- Chef::Cookbook::SyntaxCheck::PersistentSet
- Chef::CookbookCacheCleaner
- Chef::CookbookCollection
- Chef::CookbookLoader
- Chef::CookbookSiteStreamingUploader
- Chef::CookbookSiteStreamingUploader::MultipartStream
- Chef::CookbookSiteStreamingUploader::StreamPart
- Chef::CookbookSiteStreamingUploader::StringPart
- Chef::CookbookSynchronizer
- Chef::CookbookUploader
- Chef::CookbookVersion
- Chef::DSL
- Chef::DSL::DataQuery
- Chef::DSL::IncludeAttribute
- Chef::DSL::IncludeRecipe
- Chef::DSL::PlatformIntrospection
- Chef::DSL::PlatformIntrospection::PlatformDependentValue
- Chef::DSL::PlatformIntrospection::PlatformFamilyDependentValue
- Chef::DSL::Recipe
- Chef::DSL::RegistryHelper
- Chef::Daemon
- Chef::DataBag
- Chef::DataBagItem
- Chef::Digester
- Chef::EncryptedDataBagItem
- Chef::EncryptedDataBagItem::DecryptionFailure
- Chef::EncryptedDataBagItem::Decryptor
- Chef::EncryptedDataBagItem::Decryptor::Version0Decryptor
- Chef::EncryptedDataBagItem::Decryptor::Version1Decryptor
- Chef::EncryptedDataBagItem::Encryptor
- Chef::EncryptedDataBagItem::UnsupportedCipher
- Chef::EncryptedDataBagItem::UnsupportedEncryptedDataBagItemFormat
- Chef::Environment
- Chef::EventDispatch
- Chef::EventDispatch::Base
- Chef::EventDispatch::Dispatcher
- Chef::Exceptions
- Chef::Exceptions::AmbiguousRunlistSpecification
- Chef::Exceptions::Application
- Chef::Exceptions::AttributeNotFound
- Chef::Exceptions::CannotDetermineNodeName
- Chef::Exceptions::CannotWritePrivateKey
- Chef::Exceptions::CommandTimeout
- Chef::Exceptions::ConfigurationError
- Chef::Exceptions::CookbookFrozen
- Chef::Exceptions::CookbookNotFound
- Chef::Exceptions::CookbookNotFoundInRepo
- Chef::Exceptions::CookbookVersionConflict
- Chef::Exceptions::CookbookVersionNameMismatch
- Chef::Exceptions::CookbookVersionSelection
- Chef::Exceptions::CookbookVersionSelection::InvalidRunListItems
- Chef::Exceptions::CookbookVersionSelection::UnsatisfiableRunListItem
- Chef::Exceptions::Cron
- Chef::Exceptions::DsclCommandFailed
- Chef::Exceptions::EnclosingDirectoryDoesNotExist
- Chef::Exceptions::Env
- Chef::Exceptions::ErlCall
- Chef::Exceptions::Exec
- Chef::Exceptions::FileNotFound
- Chef::Exceptions::Group
- Chef::Exceptions::GroupIDNotFound
- Chef::Exceptions::Ifconfig
- Chef::Exceptions::IllegalChecksumRevert
- Chef::Exceptions::ImmutableAttributeModification
- Chef::Exceptions::InsufficientPermissions
- Chef::Exceptions::InvalidCommandOption
- Chef::Exceptions::InvalidCookbookVersion
- Chef::Exceptions::InvalidDataBagItemID
- Chef::Exceptions::InvalidDataBagName
- Chef::Exceptions::InvalidDataBagPath
- Chef::Exceptions::InvalidEnvironmentRunListSpecification
- Chef::Exceptions::InvalidHomeDirectory
- Chef::Exceptions::InvalidPrivateKey
- Chef::Exceptions::InvalidRemoteFileURI
- Chef::Exceptions::InvalidRemoteGitReference
- Chef::Exceptions::InvalidResourceReference
- Chef::Exceptions::InvalidResourceSpecification
- Chef::Exceptions::InvalidVersionConstraint
- Chef::Exceptions::Link
- Chef::Exceptions::MissingLibrary
- Chef::Exceptions::MissingParentDirectory
- Chef::Exceptions::MissingRole
- Chef::Exceptions::Mount
- Chef::Exceptions::MultipleFailures
- Chef::Exceptions::ObsoleteDependencySyntax
- Chef::Exceptions::Override
- Chef::Exceptions::Package
- Chef::Exceptions::PrivateKeyMissing
- Chef::Exceptions::RecipeNotFound
- Chef::Exceptions::RedirectLimitExceeded
- Chef::Exceptions::RequestedUIDUnavailable
- Chef::Exceptions::ResourceNotFound
- Chef::Exceptions::RoleNotFound
- Chef::Exceptions::Route
- Chef::Exceptions::SearchIndex
- Chef::Exceptions::Service
- Chef::Exceptions::SolrConnectionError
- Chef::Exceptions::StaleAttributeRead
- Chef::Exceptions::UnresolvableGitReference
- Chef::Exceptions::UnsupportedAction
- Chef::Exceptions::User
- Chef::Exceptions::UserIDNotFound
- Chef::Exceptions::ValidationFailed
- Chef::Exceptions::Win32APIError
- Chef::Exceptions::Win32APIFunctionNotImplemented
- Chef::Exceptions::Win32NotWindows
- Chef::Exceptions::Win32RegArchitectureIncorrect
- Chef::Exceptions::Win32RegBadType
- Chef::Exceptions::Win32RegBadValueSize
- Chef::Exceptions::Win32RegDataMissing
- Chef::Exceptions::Win32RegHiveMissing
- Chef::Exceptions::Win32RegKeyMissing
- Chef::Exceptions::Win32RegNoRecursive
- Chef::Exceptions::Win32RegTypeDoesNotExist
- Chef::Exceptions::Win32RegTypesMismatch
- Chef::Exceptions::Win32RegValueExists
- Chef::Exceptions::Win32RegValueMissing
- Chef::Exceptions::WindowsNotAdmin
- Chef::FileAccessControl
- Chef::FileAccessControl::Unix
- Chef::FileAccessControl::Windows
- Chef::FileAccessControl::Windows::Security
- Chef::FileCache
- Chef::Formatters
- Chef::Formatters::APIErrorFormatting
- Chef::Formatters::Base
- Chef::Formatters::Doc
- Chef::Formatters::ErrorDescription
- Chef::Formatters::ErrorInspectors
- Chef::Formatters::ErrorInspectors::CompileErrorInspector
- Chef::Formatters::ErrorInspectors::CookbookResolveErrorInspector
- Chef::Formatters::ErrorInspectors::CookbookSyncErrorInspector
- Chef::Formatters::ErrorInspectors::NodeLoadErrorInspector
- Chef::Formatters::ErrorInspectors::RegistrationErrorInspector
- Chef::Formatters::ErrorInspectors::ResourceFailureInspector
- Chef::Formatters::ErrorInspectors::RunListExpansionErrorInspector
- Chef::Formatters::ErrorMapper
- Chef::Formatters::Minimal
- Chef::Formatters::NullFormatter
- Chef::Formatters::Outputter
- Chef::Formatters::UnknownFormatter
- Chef::Handler
- Chef::Handler::ErrorReport
- Chef::Handler::JsonFile
- Chef::JSONCompat
- Chef::Knife
- Chef::Knife::Bootstrap
- Chef::Knife::ClientBulkDelete
- Chef::Knife::ClientCreate
- Chef::Knife::ClientDelete
- Chef::Knife::ClientEdit
- Chef::Knife::ClientList
- Chef::Knife::ClientReregister
- Chef::Knife::ClientShow
- Chef::Knife::Configure
- Chef::Knife::ConfigureClient
- Chef::Knife::CookbookBulkDelete
- Chef::Knife::CookbookCreate
- Chef::Knife::CookbookDelete
- Chef::Knife::CookbookDownload
- Chef::Knife::CookbookList
- Chef::Knife::CookbookMetadata
- Chef::Knife::CookbookMetadataFromFile
- Chef::Knife::CookbookSCMRepo
- Chef::Knife::CookbookShow
- Chef::Knife::CookbookSiteDownload
- Chef::Knife::CookbookSiteInstall
- Chef::Knife::CookbookSiteList
- Chef::Knife::CookbookSiteSearch
- Chef::Knife::CookbookSiteShare
- Chef::Knife::CookbookSiteShow
- Chef::Knife::CookbookSiteUnshare
- Chef::Knife::CookbookSiteVendor
- Chef::Knife::CookbookTest
- Chef::Knife::CookbookUpload
- Chef::Knife::Core
- Chef::Knife::Core::BootstrapContext
- Chef::Knife::Core::GenericPresenter
- Chef::Knife::Core::NodeFormattingOptions
- Chef::Knife::Core::NodePresenter
- Chef::Knife::Core::ObjectLoader
- Chef::Knife::Core::ObjectLoader::ObjectType
- Chef::Knife::Core::TextFormatter
- Chef::Knife::DataBagCreate
- Chef::Knife::DataBagDelete
- Chef::Knife::DataBagEdit
- Chef::Knife::DataBagFromFile
- Chef::Knife::DataBagList
- Chef::Knife::DataBagShow
- Chef::Knife::Delete
- Chef::Knife::Diff
- Chef::Knife::Download
- Chef::Knife::EnvironmentCreate
- Chef::Knife::EnvironmentDelete
- Chef::Knife::EnvironmentEdit
- Chef::Knife::EnvironmentFromFile
- Chef::Knife::EnvironmentList
- Chef::Knife::EnvironmentShow
- Chef::Knife::Exec
- Chef::Knife::Help
- Chef::Knife::IndexRebuild
- Chef::Knife::List
- Chef::Knife::NodeBulkDelete
- Chef::Knife::NodeCreate
- Chef::Knife::NodeDelete
- Chef::Knife::NodeEdit
- Chef::Knife::NodeEditor
- Chef::Knife::NodeFromFile
- Chef::Knife::NodeList
- Chef::Knife::NodeRunListAdd
- Chef::Knife::NodeRunListRemove
- Chef::Knife::NodeShow
- Chef::Knife::Raw
- Chef::Knife::RecipeList
- Chef::Knife::RoleBulkDelete
- Chef::Knife::RoleCreate
- Chef::Knife::RoleDelete
- Chef::Knife::RoleEdit
- Chef::Knife::RoleFromFile
- Chef::Knife::RoleList
- Chef::Knife::RoleShow
- Chef::Knife::Search
- Chef::Knife::Show
- Chef::Knife::Ssh
- Chef::Knife::Status
- Chef::Knife::SubcommandLoader
- Chef::Knife::TagCreate
- Chef::Knife::TagDelete
- Chef::Knife::TagList
- Chef::Knife::UI
- Chef::Knife::Upload
- Chef::Knife::UserCreate
- Chef::Knife::UserDelete
- Chef::Knife::UserEdit
- Chef::Knife::UserList
- Chef::Knife::UserReregister
- Chef::Knife::UserShow
- Chef::Log
- Chef::Log::Formatter
- Chef::Mixin
- Chef::Mixin::Checksum
- Chef::Mixin::Command
- Chef::Mixin::Command::Unix
- Chef::Mixin::Command::Windows
- Chef::Mixin::ConvertToClassName
- Chef::Mixin::CreatePath
- Chef::Mixin::DeepMerge
- Chef::Mixin::DeepMerge::InvalidParameter
- Chef::Mixin::DeepMerge::InvalidSubtractiveMerge
- Chef::Mixin::DeprecatedLanguageModule
- Chef::Mixin::Deprecation
- Chef::Mixin::Deprecation::DeprecatedInstanceVariable
- Chef::Mixin::Deprecation::DeprecatedObjectProxyBase
- Chef::Mixin::EnforceOwnershipAndPermissions
- Chef::Mixin::FileClass
- Chef::Mixin::FromFile
- Chef::Mixin::GetSourceFromPackage
- Chef::Mixin::ParamsValidate
- Chef::Mixin::PathSanity
- Chef::Mixin::Securable
- Chef::Mixin::Securable::WindowsMacros
- Chef::Mixin::Securable::WindowsSecurableAttributes
- Chef::Mixin::ShellOut
- Chef::Mixin::Template
- Chef::Mixin::Template::ChefContext
- Chef::Mixin::Template::TemplateError
- Chef::Mixin::WhyRun
- Chef::Mixin::WhyRun::ConvergeActions
- Chef::Mixin::WhyRun::ResourceRequirements
- Chef::Mixin::WhyRun::ResourceRequirements::Assertion
- Chef::Mixin::WhyRun::ResourceRequirements::Assertion::AssertionFailure
- Chef::Mixin::XMLEscape
- Chef::Mixin::XMLEscape::FastXS
- Chef::Mixin::XMLEscape::PureRuby
- Chef::Node
- Chef::Node::AttrArray
- Chef::Node::Attribute
- Chef::Node::ImmutableArray
- Chef::Node::ImmutableMash
- Chef::Node::Immutablize
- Chef::Node::VividMash
- Chef::Platform
- Chef::Provider
- Chef::Provider::Breakpoint
- Chef::Provider::CookbookFile
- Chef::Provider::Cron
- Chef::Provider::Cron::Solaris
- Chef::Provider::Deploy
- Chef::Provider::Deploy::Revision
- Chef::Provider::Deploy::Timestamped
- Chef::Provider::Directory
- Chef::Provider::Env
- Chef::Provider::Env::Windows
- Chef::Provider::ErlCall
- Chef::Provider::Execute
- Chef::Provider::File
- Chef::Provider::Git
- Chef::Provider::Group
- Chef::Provider::Group::Aix
- Chef::Provider::Group::Dscl
- Chef::Provider::Group::Gpasswd
- Chef::Provider::Group::Groupadd
- Chef::Provider::Group::Groupmod
- Chef::Provider::Group::Pw
- Chef::Provider::Group::Suse
- Chef::Provider::Group::Usermod
- Chef::Provider::Group::Windows
- Chef::Provider::HttpRequest
- Chef::Provider::Ifconfig
- Chef::Provider::LWRPBase
- Chef::Provider::LWRPBase::InlineResources
- Chef::Provider::LWRPBase::InlineResources::ClassMethods
- Chef::Provider::Link
- Chef::Provider::Log
- Chef::Provider::Log::ChefLog
- Chef::Provider::Mdadm
- Chef::Provider::Mount
- Chef::Provider::Mount::Mount
- Chef::Provider::Mount::Windows
- Chef::Provider::Ohai
- Chef::Provider::Package
- Chef::Provider::Package::Apt
- Chef::Provider::Package::Dpkg
- Chef::Provider::Package::EasyInstall
- Chef::Provider::Package::Freebsd
- Chef::Provider::Package::Ips
- Chef::Provider::Package::Macports
- Chef::Provider::Package::Pacman
- Chef::Provider::Package::Portage
- Chef::Provider::Package::Rpm
- Chef::Provider::Package::Rubygems
- Chef::Provider::Package::Rubygems::AlternateGemEnvironment
- Chef::Provider::Package::Rubygems::CurrentGemEnvironment
- Chef::Provider::Package::Rubygems::GemEnvironment
- Chef::Provider::Package::SmartOS
- Chef::Provider::Package::Solaris
- Chef::Provider::Package::Yum
- Chef::Provider::Package::Yum::RPMDb
- Chef::Provider::Package::Yum::RPMDbPackage
- Chef::Provider::Package::Yum::RPMDependency
- Chef::Provider::Package::Yum::RPMPackage
- Chef::Provider::Package::Yum::RPMProvide
- Chef::Provider::Package::Yum::RPMRequire
- Chef::Provider::Package::Yum::RPMUtils
- Chef::Provider::Package::Yum::RPMVersion
- Chef::Provider::Package::Yum::YumCache
- Chef::Provider::Package::Zypper
- Chef::Provider::RegistryKey
- Chef::Provider::RemoteDirectory
- Chef::Provider::RemoteFile
- Chef::Provider::ResourceUpdate
- Chef::Provider::Route
- Chef::Provider::RubyBlock
- Chef::Provider::Script
- Chef::Provider::Service
- Chef::Provider::Service::Arch
- Chef::Provider::Service::Debian
- Chef::Provider::Service::Freebsd
- Chef::Provider::Service::Gentoo
- Chef::Provider::Service::Init
- Chef::Provider::Service::Insserv
- Chef::Provider::Service::Invokercd
- Chef::Provider::Service::Macosx
- Chef::Provider::Service::Redhat
- Chef::Provider::Service::Simple
- Chef::Provider::Service::Solaris
- Chef::Provider::Service::Systemd
- Chef::Provider::Service::Upstart
- Chef::Provider::Service::Windows
- Chef::Provider::Subversion
- Chef::Provider::Template
- Chef::Provider::TemplateFinder
- Chef::Provider::User
- Chef::Provider::User::Dscl
- Chef::Provider::User::Pw
- Chef::Provider::User::Useradd
- Chef::Provider::User::Windows
- Chef::REST
- Chef::REST::AuthCredentials
- Chef::REST::CookieJar
- Chef::REST::NoopInflater
- Chef::REST::RESTRequest
- Chef::Recipe
- Chef::ReservedNames
- Chef::ReservedNames::Win32
- Chef::ReservedNames::Win32::API
- Chef::ReservedNames::Win32::API::Error
- Chef::ReservedNames::Win32::API::File
- Chef::ReservedNames::Win32::API::File::BY_HANDLE_FILE_INFORMATION
- Chef::ReservedNames::Win32::API::File::FILETIME
- Chef::ReservedNames::Win32::API::File::REPARSE_DATA_BUFFER
- Chef::ReservedNames::Win32::API::File::REPARSE_DATA_BUFFER_GENERIC
- Chef::ReservedNames::Win32::API::File::REPARSE_DATA_BUFFER_MOUNT_POINT
- Chef::ReservedNames::Win32::API::File::REPARSE_DATA_BUFFER_SYMBOLIC_LINK
- Chef::ReservedNames::Win32::API::File::REPARSE_DATA_BUFFER_UNION
- Chef::ReservedNames::Win32::API::File::SECURITY_ATTRIBUTES
- Chef::ReservedNames::Win32::API::File::WIN32_FIND_DATA
- Chef::ReservedNames::Win32::API::Macros
- Chef::ReservedNames::Win32::API::Memory
- Chef::ReservedNames::Win32::API::PSAPI
- Chef::ReservedNames::Win32::API::PSAPI::PROCESS_MEMORY_COUNTERS
- Chef::ReservedNames::Win32::API::Process
- Chef::ReservedNames::Win32::API::Security
- Chef::ReservedNames::Win32::API::Security::ACE_HEADER
- Chef::ReservedNames::Win32::API::Security::ACE_WITH_MASK_AND_SID
- Chef::ReservedNames::Win32::API::Security::ACLStruct
- Chef::ReservedNames::Win32::API::Security::LUID
- Chef::ReservedNames::Win32::API::Security::LUID_AND_ATTRIBUTES
- Chef::ReservedNames::Win32::API::Security::TOKEN_PRIVILEGES
- Chef::ReservedNames::Win32::API::System
- Chef::ReservedNames::Win32::API::System::OSVERSIONINFOEX
- Chef::ReservedNames::Win32::API::Unicode
- Chef::ReservedNames::Win32::Error
- Chef::ReservedNames::Win32::File
- Chef::ReservedNames::Win32::File::Info
- Chef::ReservedNames::Win32::Handle
- Chef::ReservedNames::Win32::Memory
- Chef::ReservedNames::Win32::Process
- Chef::ReservedNames::Win32::Security
- Chef::ReservedNames::Win32::Security::ACE
- Chef::ReservedNames::Win32::Security::ACL
- Chef::ReservedNames::Win32::Security::SID
- Chef::ReservedNames::Win32::Security::SecurableObject
- Chef::ReservedNames::Win32::Security::SecurityDescriptor
- Chef::ReservedNames::Win32::Security::Token
- Chef::ReservedNames::Win32::Unicode
- Chef::ReservedNames::Win32::Version
- Chef::Resource
- Chef::Resource::AptPackage
- Chef::Resource::Bash
- Chef::Resource::Breakpoint
- Chef::Resource::ChefGem
- Chef::Resource::Conditional
- Chef::Resource::CookbookFile
- Chef::Resource::Cron
- Chef::Resource::Csh
- Chef::Resource::Deploy
- Chef::Resource::DeployBranch
- Chef::Resource::DeployRevision
- Chef::Resource::Directory
- Chef::Resource::DpkgPackage
- Chef::Resource::EasyInstallPackage
- Chef::Resource::Env
- Chef::Resource::ErlCall
- Chef::Resource::Execute
- Chef::Resource::File
- Chef::Resource::FreebsdPackage
- Chef::Resource::GemPackage
- Chef::Resource::Git
- Chef::Resource::Group
- Chef::Resource::HttpRequest
- Chef::Resource::Ifconfig
- Chef::Resource::IpsPackage
- Chef::Resource::LWRPBase
- Chef::Resource::Link
- Chef::Resource::Log
- Chef::Resource::MacportsPackage
- Chef::Resource::Mdadm
- Chef::Resource::Mount
- Chef::Resource::Notification
- Chef::Resource::Ohai
- Chef::Resource::Package
- Chef::Resource::PacmanPackage
- Chef::Resource::Perl
- Chef::Resource::PlatformMap
- Chef::Resource::PortagePackage
- Chef::Resource::Python
- Chef::Resource::RegistryKey
- Chef::Resource::RemoteDirectory
- Chef::Resource::RemoteFile
- Chef::Resource::Route
- Chef::Resource::RpmPackage
- Chef::Resource::Ruby
- Chef::Resource::RubyBlock
- Chef::Resource::Scm
- Chef::Resource::Script
- Chef::Resource::Service
- Chef::Resource::SmartOSPackage
- Chef::Resource::SolarisPackage
- Chef::Resource::Subversion
- Chef::Resource::Template
- Chef::Resource::TimestampedDeploy
- Chef::Resource::User
- Chef::Resource::YumPackage
- Chef::ResourceCollection
- Chef::ResourceCollection::StepableIterator
- Chef::ResourceDefinition
- Chef::ResourceDefinitionList
- Chef::ResourceReporter
- Chef::ResourceReporter::ResourceReport
- Chef::Role
- Chef::RunContext
- Chef::RunContext::CookbookCompiler
- Chef::RunList
- Chef::RunList::RunListExpansion
- Chef::RunList::RunListExpansionFromAPI
- Chef::RunList::RunListExpansionFromDisk
- Chef::RunList::RunListItem
- Chef::RunList::VersionedRecipeList
- Chef::RunLock
- Chef::RunStatus
- Chef::Runner
- Chef::Sandbox
- Chef::ScanAccessControl
- Chef::Search
- Chef::Search::Query
- Chef::ShellOut
- Chef::StreamingCookbookUploader
- Chef::StreamingCookbookUploader::MultipartStream
- Chef::StreamingCookbookUploader::StreamPart
- Chef::StreamingCookbookUploader::StringPart
- Chef::User
- Chef::Util
- Chef::Util::FileEdit
- Chef::Util::Windows
- Chef::Util::Windows::NetGroup
- Chef::Util::Windows::NetUse
- Chef::Util::Windows::NetUser
- Chef::Util::Windows::Volume
- Chef::Version
- Chef::VersionConstraint
- Chef::Win32
- Chef::Win32::Registry
- Shell
- Shell::ClientSession
- Shell::DoppelGangerClient
- Shell::DoppelGangerSession
- Shell::Extensions
- Shell::Extensions::FalseClass
- Shell::Extensions::ObjectCoreExtensions
- Shell::Extensions::String
- Shell::Extensions::Symbol
- Shell::Extensions::TrueClass
- Shell::ModelWrapper
- Shell::NamedDataBagWrapper
- Shell::Options
- Shell::ShellREST
- Shell::ShellSession
- Shell::SoloSession
- Shell::StandAloneSession
- Net
- Net::HTTPError
- Net::HTTPFatalError
- Net::HTTPRetriableError
- Net::HTTPServerException
- FFI
- FFI::Pointer
- FileUtils
- FileUtils::Entry_
- ChefNetHTTPExceptionExtensions
- Dir
- FalseClass
- Mash
- Numeric
- Object
- Regexp
- String
- Symbol
- TrueClass

No matching classes.

# Chef::Knife::Ssh

### Attributes

password[W]

### Public Instance Methods

configure_attribute() click to toggle source

    # File lib/chef/knife/ssh.rb, line 372
    def configure_attribute
      # Setting 'knife[:ssh_attribute] = "foo"' in knife.rb => Chef::Config[:knife][:ssh_attribute] == 'foo'
      # Running 'knife ssh -a foo' => both Chef::Config[:knife][:ssh_attribute] && config[:attribute] == foo
      # Thus we can differentiate between a config file value and a command line override at this point by checking config[:attribute]
      # We can tell here if fqdn was passed from the command line, rather than being the default, by checking config[:attribute]
      # However, after here, we cannot tell these things, so we must preserve config[:attribute]
      config[:override_attribute] = config[:attribute] || Chef::Config[:knife][:ssh_attribute]
      config[:attribute] = (Chef::Config[:knife][:ssh_attribute] ||
                            config[:attribute] ||
                            "fqdn").strip
    end

configure_gateway() click to toggle source

    # File lib/chef/knife/ssh.rb, line 117
    def configure_gateway
      config[:ssh_gateway] ||= Chef::Config[:knife][:ssh_gateway]
      if config[:ssh_gateway]
        gw_host, gw_user = config[:ssh_gateway].split('@').reverse
        gw_host, gw_port = gw_host.split(':')
        gw_opts = gw_port ? { :port => gw_port } : {}

        session.via(gw_host, gw_user || config[:ssh_user], gw_opts)
      end
    rescue Net::SSH::AuthenticationFailed
      user = gw_user || config[:ssh_user]
      prompt = "Enter the password for #{user}@#{gw_host}: "
      gw_opts.merge!(:password => prompt_for_password(prompt))
      session.via(gw_host, user, gw_opts)
    end

configure_identity_file() click to toggle source

    # File lib/chef/knife/ssh.rb, line 413
    def configure_identity_file
      config[:identity_file] = get_stripped_unfrozen_value(config[:identity_file] ||
                           Chef::Config[:knife][:ssh_identity_file])
    end

configure_session() click to toggle source

    # File lib/chef/knife/ssh.rb, line 133
    def configure_session
      list = case config[:manual]
             when true
               @name_args[0].split(" ")
             when false
               r = Array.new
               q = Chef::Search::Query.new
               @action_nodes = q.search(:node, @name_args[0])[0]
               @action_nodes.each do |item|
                 # we should skip the loop to next iteration if the item returned by the search is nil
                 next if item.nil?
                 # if a command line attribute was not passed, and we have a cloud public_hostname, use that.
                 # see #configure_attribute for the source of config[:attribute] and config[:override_attribute]
                 if !config[:override_attribute] && item[:cloud] and item[:cloud][:public_hostname]
                   i = item[:cloud][:public_hostname]
                 elsif config[:override_attribute]
                   i = extract_nested_value(item, config[:override_attribute])
                 else
                   i = extract_nested_value(item, config[:attribute])
                 end
                 # next if we couldn't find the specified attribute in the returned node object
                 next if i.nil?
                 r.push(i)
               end
               r
             end
      if list.length == 0
        if @action_nodes.length == 0
          ui.fatal("No nodes returned from search!")
        else
          ui.fatal("#{@action_nodes.length} #{@action_nodes.length > 1 ? "nodes":"node"} found, " +
                   "but does not have the required attribute to establish the connection. " +
                   "Try setting another attribute to open the connection using --attribute.")
        end
        exit 10
      end
      session_from_list(list)
    end

configure_user() click to toggle source

    # File lib/chef/knife/ssh.rb, line 408
    def configure_user
      config[:ssh_user] = get_stripped_unfrozen_value(config[:ssh_user] ||
                           Chef::Config[:knife][:ssh_user])
    end

cssh() click to toggle source

    # File lib/chef/knife/ssh.rb, line 384
    def cssh
      cssh_cmd = nil
      ]csshX cssh].each do |cmd|
        begin
          # Unix and Mac only
          cssh_cmd = shell_out!("which #{cmd}").stdout.strip
          break
        rescue Mixlib::ShellOut::ShellCommandFailed
        end
      end
      raise Chef::Exceptions::Exec, "no command found for cssh" unless cssh_cmd

      session.servers_for.each do |server|
        cssh_cmd << " #{server.user ? "#{server.user}@#{server.host}" : server.host}"
      end
      Chef::Log.debug("starting cssh session with command: #{cssh_cmd}")
      exec(cssh_cmd)
    end

extract_nested_value(data_structure, path_spec) click to toggle source

    # File lib/chef/knife/ssh.rb, line 418
    def extract_nested_value(data_structure, path_spec)
      ui.presenter.extract_nested_value(data_structure, path_spec)
    end

fixup_sudo(command) click to toggle source

    # File lib/chef/knife/ssh.rb, line 201
    def fixup_sudo(command)
      command.sub(/^sudo/, 'sudo -p \knife sudo password: \')
    end

get_password() click to toggle source

    # File lib/chef/knife/ssh.rb, line 239
    def get_password
      @password ||= prompt_for_password
    end

get_stripped_unfrozen_value(value) click to toggle source

    # File lib/chef/knife/ssh.rb, line 403
    def get_stripped_unfrozen_value(value)
      return nil if value.nil?
      value.strip
    end

interactive() click to toggle source

    # File lib/chef/knife/ssh.rb, line 272
    def interactive
      puts "Connected to #{ui.list(session.servers_for.collect { |s| ui.color(s.host, :cyan) }, :inline, " and ")}"
      puts
      puts "To run a command on a list of servers, do:"
      puts "  on SERVER1 SERVER2 SERVER3; COMMAND"
      puts "  Example: on latte foamy; echo foobar"
      puts
      puts "To exit interactive mode, use 'quit!'"
      puts
      while 1
        command = read_line
        case command
        when 'quit!'
          puts 'Bye!'
          break
        when /^on (.+?); (.+)$/
          raw_list = $1.split(" ")
          server_list = Array.new
          session.servers.each do |session_server|
            server_list << session_server if raw_list.include?(session_server.host)
          end
          command = $2
          ssh_command(command, session.on(*server_list))
        else
          ssh_command(command)
        end
      end
    end

macterm() click to toggle source

    # File lib/chef/knife/ssh.rb, line 348
    def macterm
      begin
        require 'appscript'
      rescue LoadError
        STDERR.puts "you need the rb-appscript gem to use knife ssh macterm. `(sudo) gem install rb-appscript` to install"
        raise
      end

      Appscript.app("/Applications/Utilities/Terminal.app").windows.first.activate
      Appscript.app("System Events").application_processes["Terminal.app"].keystroke("n", :using=>:command_down)
      term = Appscript.app('Terminal')
      window = term.windows.first.get

      (session.servers_for.size - 1).times do |i|
        window.activate
        Appscript.app("System Events").application_processes["Terminal.app"].keystroke("t", :using=>:command_down)
      end

      session.servers_for.each_with_index do |server, tab_number|
        cmd = "unset PROMPT_COMMAND; echo -e \"\\033]0;#{server.host}\\007\"; ssh #{server.user ? "#{server.user}@#{server.host}" : server.host}"
        Appscript.app('Terminal').do_script(cmd, :in => window.tabs[tab_number + 1].get)
      end
    end

print_data(host, data) click to toggle source

    # File lib/chef/knife/ssh.rb, line 205
    def print_data(host, data)
      if data =~ /\n/
        data.split(/\n/).each { |d| print_data(host, d) }
      else
        padding = @longest - host.length
        str = ui.color(host, :cyan) + (" " * (padding + 1)) + data
        ui.msg(str)
      end
    end

prompt_for_password(prompt = "Enter your password: ") click to toggle source

    # File lib/chef/knife/ssh.rb, line 243
    def prompt_for_password(prompt = "Enter your password: ")
      ui.ask(prompt) { |q| q.echo = false }
    end

read_line() click to toggle source

Present the prompt and read a single line from the console. It also detects ^D and returns "exit" in that case. Adds the input to the history, unless the input is empty. Loops repeatedly until a non-empty line is input.

    # File lib/chef/knife/ssh.rb, line 251
    def read_line
      loop do
        command = reader.readline("#{ui.color('knife-ssh>', :bold)} ", true)

        if command.nil?
          command = "exit"
          puts(command)
        else
          command.strip!
        end

        unless command.empty?
          return command
        end
      end
    end

reader() click to toggle source

    # File lib/chef/knife/ssh.rb, line 268
    def reader
      Readline
    end

run() click to toggle source

    # File lib/chef/knife/ssh.rb, line 422
    def run
      extend Chef::Mixin::Command

      @longest = 0

      configure_attribute
      configure_user
      configure_identity_file
      configure_gateway
      configure_session

      exit_status =
      case @name_args[1]
      when "interactive"
        interactive
      when "screen"
        screen
      when "tmux"
        tmux
      when "macterm"
        macterm
      when "cssh"
        cssh
      when "csshx"
        Chef::Log.warn("knife ssh csshx will be deprecated in a future release")
        Chef::Log.warn("please use knife ssh cssh instead")
        cssh
      else
        ssh_command(@name_args[1..-1].join(" "))
      end

      session.close
      if exit_status != 0
        exit exit_status
      else
        exit_status
      end
    end

screen() click to toggle source

    # File lib/chef/knife/ssh.rb, line 301
    def screen
      tf = Tempfile.new("knife-ssh-screen")
      if File.exist? "#{ENV["HOME"]}/.screenrc"
        tf.puts("source #{ENV["HOME"]}/.screenrc")
      end
      tf.puts("caption always '%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<'")
      tf.puts("hardstatus alwayslastline 'knife ssh #{@name_args[0]}'")
      window = 0
      session.servers_for.each do |server|
        tf.print("screen -t \"#{server.host}\" #{window} ssh ")
        tf.print("-i #{config[:identity_file]} ") if config[:identity_file]
        server.user ? tf.puts("#{server.user}@#{server.host}") : tf.puts(server.host)
        window += 1
      end
      tf.close
      exec("screen -c #{tf.path}")
    end

session() click to toggle source

    # File lib/chef/knife/ssh.rb, line 94
    def session
      config[:on_error] ||= :skip
      ssh_error_handler = Proc.new do |server|
        if config[:manual]
          node_name = server.host
        else
          @action_nodes.each do |n|
            node_name = n if format_for_display(n)[config[:attribute]] == server.host
          end
        end
        case config[:on_error]
        when :skip
          ui.warn "Failed to connect to #{node_name} -- #{$!.class.name}: #{$!.message}"
          $!.backtrace.each { |l| Chef::Log.debug(l) }
        when :raise
          #Net::SSH::Multi magic to force exception to be re-raised.
          throw :go, :raise
        end
      end

      @session ||= Net::SSH::Multi.start(:concurrent_connections => config[:concurrency], :on_error => ssh_error_handler)
    end

session_from_list(list) click to toggle source

    # File lib/chef/knife/ssh.rb, line 172
    def session_from_list(list)
      list.each do |item|
        Chef::Log.debug("Adding #{item}")
        session_opts = {}

        ssh_config = Net::SSH.configuration_for(item)

        # Chef::Config[:knife][:ssh_user] is parsed in #configure_user and written to config[:ssh_user]
        user = config[:ssh_user] || ssh_config[:user]
        hostspec = user ? "#{user}@#{item}" : item
        session_opts[:keys] = File.expand_path(config[:identity_file]) if config[:identity_file]
        session_opts[:keys_only] = true if config[:identity_file]
        session_opts[:password] = config[:ssh_password] if config[:ssh_password]
        session_opts[:port] = config[:ssh_port] || Chef::Config[:knife][:ssh_port] || ssh_config[:port]
        session_opts[:logger] = Chef::Log.logger if Chef::Log.level == :debug

        if !config[:host_key_verify]
          session_opts[:paranoid] = false
          session_opts[:user_known_hosts_file] = "/dev/null"
        end

        session.use(hostspec, session_opts)

        @longest = item.length if item.length > @longest
      end

      session
    end

ssh_command(command, subsession=nil) click to toggle source

    # File lib/chef/knife/ssh.rb, line 215
    def ssh_command(command, subsession=nil)
      exit_status = 0
      subsession ||= session
      command = fixup_sudo(command)
      command.force_encoding('binary') if command.respond_to?(:force_encoding)
      subsession.open_channel do |ch|
        ch.request_pty
        ch.exec command do |ch, success|
          raise ArgumentError, "Cannot execute #{command}" unless success
          ch.on_data do |ichannel, data|
            print_data(ichannel[:host], data)
            if data =~ /^knife sudo password: /
              ichannel.send_data("#{get_password}\n")
            end
          end
          ch.on_request "exit-status" do |ichannel, data|
            exit_status = [exit_status, data.read_long].max
          end
        end
      end
      session.loop
      exit_status
    end

tmux() click to toggle source

    # File lib/chef/knife/ssh.rb, line 319
    def tmux
      ssh_dest = lambda do |server|
        identity = "-i #{config[:identity_file]} " if config[:identity_file]
        prefix = server.user ? "#{server.user}@" : ""
        "'ssh #{identity}#{prefix}#{server.host}'"
      end

      new_window_cmds = lambda do
        if session.servers_for.size > 1
          [""] + session.servers_for[1..-1].map do |server|
            "new-window -a -n '#{server.host}' #{ssh_dest.call(server)}"
          end
        else
          []
        end.join(" \\; ")
      end

      tmux_name = "'knife ssh #{@name_args[0].gsub(/:/,'=')}'"
      begin
        server = session.servers_for.first
        cmd = ["tmux new-session -d -s #{tmux_name}",
               "-n '#{server.host}'", ssh_dest.call(server),
               new_window_cmds.call].join(" ")
        shell_out!(cmd)
        exec("tmux attach-session -t #{tmux_name}")
      rescue Chef::Exceptions::Exec
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.