logo

seq:数字を表示

7時から10時まで15分おきに表示するワンライナー [#q96a0d0e]

One minute to read

Serverspecのインストール

gem 'serverspec' gem 'rake' gem 'highline'

gem install bundle

Successfully installed bundler-1.10.6 Successfully installed bundle-0.0.1 2 gems installed Installing ri documentation for bundler-1.10.6… Installing ri documentation for bundle-0.0.1… File not found: lib

bundle

Fetching gem metadata from https://rubygems.org/ ……. Fetching version metadata from https://rubygems.org/ .. Resolving dependencies… Using rake 10.4.2 Installing diff-lcs 1.2.5 Installing highline 1.7.8 Installing multi_json 1.11.2 Installing net-ssh 2.9.2 Installing net-scp 1.2.1 Installing net-telnet 0.1.1 Installing rspec-support 3.4.1 Installing rspec-core 3.4.1 Installing rspec-expectations 3.4.0 Installing rspec-mocks 3.4.0 Installing rspec 3.4.0 Installing rspec-its 1.2.0 Installing sfl 2.2 Installing specinfra 2.44.6 Installing serverspec 2.24.3 Using bundler 1.10.6 Bundle complete! 3 Gemfile dependencies, 17 gems now installed. Use bundle show [gemname] to see where a bundled gem is installed.

One minute to read

Serverspecの基本的な使い方

  1. UN*X
  2. Windows

Select number: 1

Select a backend type:

  1. SSH
  2. Exec (local)

Select number: 1

Vagrant instance y/n: n Input target host name: 192.168.33.10

  • spec/
  • spec/centos62.local/
  • spec/centos62.local/sample_spec.rb
  • spec/spec_helper.rb
  • Rakefile serverspecを実行するユーザーの

Package "httpd" should be installed

Service "httpd" should be enabled should be running

Port "80" should be listening

Port "22" should be listening

Finished in 0.13984 seconds (files took 6.17 seconds to load) 5 examples, 0 failures 特定のホストにだけ実行する [#q49e913a]

One minute to read

SFTPでchroot設定をする

※下記項目はAllowUsersより下に記述する。 Match User hogeuser ChrootDirectory

  ForceCommand internal-sftp

/usr/sbin/sshd -t

service sshd restart

2016/1/12追記 [#t7e76b8c]

この場合、chrootさせたいユーザーが操作可能な範囲は、tmpdir/ftpdata/配下のみとなります。 参考URL [#b585ee57]

One minute to read