ミライハック
  • Home
  • Categories
  • About

>> Home / LInux

PleskでChrooted環境に新しいコマンドをインストールする

∵ Takayoshi Saito ∴ 2019-06-27 ∞ 2'

Pleskでchrooted環境を拡張するには

Plesk / OnixではSSH接続したユーザーが実行できるコマンドは制限されており(Chrooted)、通常bashなどで使えるコマンドが実行できない場合が多いです。これあhシステムをセキュアに保つための措置ですが、何らかの事由によりchroot環境を拡張したい場合もあるでしょう。

そのような場合は以下のコマンドで拡張することができます。

$ wget http://kb.odin.com/Attachments/kcs-19590/chroot_update.zip
# unzip chroot_update.zip
# chmod +x chroot_update.sh
# ./chroot_update.sh --help

最後に実行したのはインストールコマンドのヘルプで、以下のようなマニュアルが表示されるかと思います。

Manage chrooted template in /var/www/vhosts/chroot and apply it to domains.

Usage:
  ./chroot_update.sh --install
  ./chroot_update.sh --update
    Create default chrooted environment or update existing one
    using actual libraries from the system.

  ./chroot_update.sh --add 
    Add program to chrooted environment. All linked libraries
    will be copied as well. Program will always be put in /bin
    directory of chrooted environment.

  ./chroot_update.sh --devices
    Add additional devices to chrooted environment template. List
    of devices added includes: /dev/tty, /dev/urandom, /dev/ptmx
    and /dev/zero. Useful for some commands like 'rsync', 'ssh' etc.

  ./chroot_update.sh --remove 
  ./chroot_update.sh --remove all
    Remove chrooted environment from specific domains (comma-separated
    list) or all domains with enabled chrooted shell if no domains are
    given. Useful if full re-initialization of chrooted shell environment
    on domain is needed.

  ./chroot_update.sh --apply 
  ./chroot_update.sh --apply all
    Apply new chrooted template to specific domains (comma-separated
    list) or all domains with enabled chrooted shell if no domains
    are given. This operation is necessary to apply changes done by
    '--install', '--add' and '--devices' commands to specific or all
    domains.

例えばSSHコマンドを実行したい場合は下記のようにコマンドを入力してインストール可能です。

$ sudo ./chroot_update.sh --devices
$ sudo ./chroot_update.sh --add `which ssh`
$ sudo cp /etc/resolv.conf /var/www/vhosts/chroot/etc/
$ sudo ./chroot_update.sh --apply all

参考

新しいプログラムを chroot シェル環境テンプレートに追加するには

Search

Categories
  • LInux
  • インターネット
  • インフラ
  • エッセイ
  • ゲーム
  • システム開発
  • セキュリティ
  • データサイエンス
  • 国際関係
  • 政治
  • 歴史
  • 社会学
  • 自己紹介
  • 行ってきた

Pages
  • 齊藤貴義
  • 職務経歴
  • スクレイピング・ハッキング・ラボ サポートページ
  • 『爆速開発を支えるClaude Code上級者テクニック』サポートページ

2026 © Takayoshi Saito | Twitter GitHub | Built on Zola