Method: Unix::Exec#ssh_permit_user_environment

Defined in:
lib/beaker/host/unix/exec.rb

#ssh_permit_user_environmentResult

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Sets the PermitUserEnvironment setting & restarts the SSH service.

Returns:



301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/beaker/host/unix/exec.rb', line 301

def ssh_permit_user_environment
  case self['platform']
  when /amazon|debian|ubuntu|archlinux|el-|centos|fedora|redhat|oracle|scientific|opensuse|sles|solaris/
    directory = tmpdir
    exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
    exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
    exec(Beaker::Command.new("echo '' >/etc/environment")) if self['platform'].include?('ubuntu-')
  when /(free|open)bsd/
    exec(Beaker::Command.new("sudo perl -pi -e 's/^#?PermitUserEnvironment no/PermitUserEnvironment yes/' /etc/ssh/sshd_config"), { :pty => true })
  else
    raise ArgumentError, "Unsupported Platform: '#{self['platform']}'"
  end

  ssh_service_restart
end